Skip to content

Commit f90025e

Browse files
[llvm] Compare std::optional<T> to values directly (NFC) (#146222)
This patch transforms: X && *X == Y to: X == Y where X is of std::optional<T>, and Y is of T or similar.
1 parent bad5a74 commit f90025e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/lib/TargetParser/AArch64TargetParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ std::optional<AArch64::ArchInfo> AArch64::ArchInfo::findBySubArch(StringRef SubA
5050

5151
std::optional<AArch64::FMVInfo> lookupFMVByID(AArch64::ArchExtKind ExtID) {
5252
for (const AArch64::FMVInfo &Info : AArch64::getFMVInfo())
53-
if (Info.ID && *Info.ID == ExtID)
53+
if (Info.ID == ExtID)
5454
return Info;
5555
return {};
5656
}

llvm/unittests/Support/RISCVAttributeParserTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static bool testAttribute(unsigned Tag, unsigned Value, unsigned ExpectedTag,
4545
cantFail(Parser.parse(Bytes, llvm::endianness::little));
4646

4747
std::optional<unsigned> Attr = Parser.getAttributeValue("", ExpectedTag);
48-
return Attr && *Attr == ExpectedValue;
48+
return Attr == ExpectedValue;
4949
}
5050

5151
static bool testTagString(unsigned Tag, const char *name) {

0 commit comments

Comments
 (0)