[llvm] 7c88445 - [MCParser] Use std::optional in WasmAsmParser.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 12:26:16 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T12:26:10-08:00
New Revision: 7c88445a3c5a882ed1f7cead01211b2410dff03c

URL: https://github.com/llvm/llvm-project/commit/7c88445a3c5a882ed1f7cead01211b2410dff03c
DIFF: https://github.com/llvm/llvm-project/commit/7c88445a3c5a882ed1f7cead01211b2410dff03c.diff

LOG: [MCParser] Use std::optional in WasmAsmParser.cpp (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    llvm/lib/MC/MCParser/WasmAsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCParser/WasmAsmParser.cpp b/llvm/lib/MC/MCParser/WasmAsmParser.cpp
index 7f9c4050d383..75b69ee4c8ca 100644
--- a/llvm/lib/MC/MCParser/WasmAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/WasmAsmParser.cpp
@@ -26,6 +26,7 @@
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbolWasm.h"
 #include "llvm/Support/Casting.h"
+#include <optional>
 
 using namespace llvm;
 
@@ -152,7 +153,7 @@ class WasmAsmParser : public MCAsmParserExtension {
     if (Lexer->isNot(AsmToken::String))
       return error("expected string in directive, instead got: ", Lexer->getTok());
 
-    auto Kind = StringSwitch<Optional<SectionKind>>(Name)
+    auto Kind = StringSwitch<std::optional<SectionKind>>(Name)
                     .StartsWith(".data", SectionKind::getData())
                     .StartsWith(".tdata", SectionKind::getThreadData())
                     .StartsWith(".tbss", SectionKind::getThreadBSS())


        


More information about the llvm-commits mailing list