diff options
author | Kazu Hirata <kazu@google.com> | 2022-06-20 10:38:12 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-06-20 10:38:12 -0700 |
commit | e0e687a615c1fdb6ba034fc2e48b0834a372706f (patch) | |
tree | 79455a1fe4a3d455cbd304ca0c7c77dde47e1f61 /llvm/lib/MC | |
parent | [clang][dataflow] Extend flow condition in the body of a do/while loop (diff) | |
download | llvm-project-e0e687a615c1fdb6ba034fc2e48b0834a372706f.tar.gz llvm-project-e0e687a615c1fdb6ba034fc2e48b0834a372706f.tar.bz2 llvm-project-e0e687a615c1fdb6ba034fc2e48b0834a372706f.zip |
[llvm] Don't use Optional::hasValue (NFC)
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCDXContainerWriter.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/MasmParser.cpp | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCDXContainerWriter.cpp b/llvm/lib/MC/MCDXContainerWriter.cpp index 9251bd0b3001..f5dad702d6f6 100644 --- a/llvm/lib/MC/MCDXContainerWriter.cpp +++ b/llvm/lib/MC/MCDXContainerWriter.cpp @@ -114,7 +114,7 @@ uint64_t DXContainerObjectWriter::writeObject(MCAssembler &Asm, const Triple &TT = Asm.getContext().getTargetTriple(); VersionTuple Version = TT.getOSVersion(); Header.MajorVersion = static_cast<uint8_t>(Version.getMajor()); - if (Version.getMinor().hasValue()) + if (Version.getMinor()) Header.MinorVersion = static_cast<uint8_t>(*Version.getMinor()); if (TT.hasEnvironment()) Header.ShaderKind = diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 4ca060759ce2..0c4ed201a0c5 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -796,7 +796,7 @@ MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc, const MCSubtargetInfo &STI) { Optional<MCFixupKind> MaybeKind = Assembler->getBackend().getFixupKind(Name); - if (!MaybeKind.hasValue()) + if (!MaybeKind) return std::make_pair(true, std::string("unknown relocation name")); MCFixupKind Kind = *MaybeKind; diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp index 8e6db039c2c8..7ed37b02f460 100644 --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/llvm/lib/MC/MCParser/MasmParser.cpp @@ -1190,7 +1190,7 @@ bool MasmParser::expandMacros() { } } - if (!ExpandedValue.hasValue()) + if (!ExpandedValue) return true; std::unique_ptr<MemoryBuffer> Instantiation = MemoryBuffer::getMemBufferCopy(*ExpandedValue, "<instantiation>"); @@ -2902,7 +2902,7 @@ bool MasmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, if (Body[Pos] == '&') break; if (isMacroParameterChar(Body[Pos])) { - if (!CurrentQuote.hasValue()) + if (!CurrentQuote) break; if (IdentifierPos == End) IdentifierPos = Pos; @@ -2911,7 +2911,7 @@ bool MasmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, } // Track quotation status - if (!CurrentQuote.hasValue()) { + if (!CurrentQuote) { if (Body[Pos] == '\'' || Body[Pos] == '"') CurrentQuote = Body[Pos]; } else if (Body[Pos] == CurrentQuote) { @@ -3330,7 +3330,7 @@ bool MasmParser::handleMacroInvocation(const MCAsmMacro *M, SMLoc NameLoc) { ParseStatementInfo Info(&AsmStrRewrites); bool Parsed = parseStatement(Info, nullptr); - if (!Parsed && Info.ExitValue.hasValue()) { + if (!Parsed && Info.ExitValue) { ExitValue = std::move(*Info.ExitValue); break; } @@ -3625,7 +3625,7 @@ bool MasmParser::parseTextItem(std::string &Data) { if (BuiltinIt != BuiltinSymbolMap.end()) { llvm::Optional<std::string> BuiltinText = evaluateBuiltinTextMacro(BuiltinIt->getValue(), StartLoc); - if (!BuiltinText.hasValue()) { + if (!BuiltinText) { // Not a text macro; break without substituting break; } |