[IRReader] Convert Optional in DataLayoutCallbackTy to std::optional
authorKrzysztof Parzyszek <kparzysz@quicinc.com>
Wed, 7 Dec 2022 16:18:35 +0000 (08:18 -0800)
committerKrzysztof Parzyszek <kparzysz@quicinc.com>
Wed, 7 Dec 2022 16:47:25 +0000 (08:47 -0800)
llvm/include/llvm/AsmParser/Parser.h
llvm/include/llvm/Bitcode/BitcodeReader.h
llvm/include/llvm/CodeGen/MIRParser/MIRParser.h
llvm/include/llvm/IRReader/IRReader.h
llvm/lib/IRReader/IRReader.cpp
llvm/tools/llc/llc.cpp
llvm/tools/llvm-as/llvm-as.cpp
llvm/tools/llvm-reduce/ReducerWorkItem.cpp
llvm/tools/opt/opt.cpp

index b567a3e..64ef703 100644 (file)
 #ifndef LLVM_ASMPARSER_PARSER_H
 #define LLVM_ASMPARSER_PARSER_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
+#include <optional>
 
 namespace llvm {
 
@@ -30,7 +30,7 @@ struct SlotMapping;
 class SMDiagnostic;
 class Type;
 
-typedef llvm::function_ref<Optional<std::string>(StringRef)>
+typedef llvm::function_ref<std::optional<std::string>(StringRef)>
     DataLayoutCallbackTy;
 
 /// This function is a main interface to the LLVM Assembly Parser. It parses
index 2a49341..6b4e027 100644 (file)
@@ -23,6 +23,7 @@
 #include "llvm/Support/MemoryBufferRef.h"
 #include <cstdint>
 #include <memory>
+#include <optional>
 #include <string>
 #include <system_error>
 #include <vector>
@@ -33,7 +34,7 @@ class Module;
 class MemoryBuffer;
 class ModuleSummaryIndex;
 
-typedef llvm::function_ref<Optional<std::string>(StringRef)>
+typedef llvm::function_ref<std::optional<std::string>(StringRef)>
     DataLayoutCallbackTy;
 
   // These functions are for converting Expected/Error values to
index 5ce1048..e9ffc51 100644 (file)
 #define LLVM_CODEGEN_MIRPARSER_MIRPARSER_H
 
 #include "llvm/ADT/None.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include <functional>
 #include <memory>
+#include <optional>
 
 namespace llvm {
 
@@ -36,7 +36,7 @@ class MachineModuleInfo;
 class SMDiagnostic;
 class StringRef;
 
-typedef llvm::function_ref<Optional<std::string>(StringRef)>
+typedef llvm::function_ref<std::optional<std::string>(StringRef)>
     DataLayoutCallbackTy;
 
 /// This class initializes machine functions by applying the state loaded from
index 13f561d..766ad2b 100644 (file)
 #ifndef LLVM_IRREADER_IRREADER_H
 #define LLVM_IRREADER_IRREADER_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include <memory>
+#include <optional>
 
 namespace llvm {
 
@@ -28,7 +28,7 @@ class Module;
 class SMDiagnostic;
 class LLVMContext;
 
-typedef llvm::function_ref<Optional<std::string>(StringRef)>
+typedef llvm::function_ref<std::optional<std::string>(StringRef)>
     DataLayoutCallbackTy;
 
 /// If the given MemoryBuffer holds a bitcode image, return a Module
index b645e0b..7765c3f 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/Support/raw_ostream.h"
+#include <optional>
 #include <system_error>
 
 using namespace llvm;
index 26ad622..b2cb92a 100644 (file)
@@ -529,7 +529,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
   // If user just wants to list available options, skip module loading
   if (!SkipModule) {
     auto SetDataLayout =
-        [&](StringRef DataLayoutTargetTriple) -> Optional<std::string> {
+        [&](StringRef DataLayoutTargetTriple) -> std::optional<std::string> {
       // If we are supposed to override the target triple, do so now.
       std::string IRTargetTriple = DataLayoutTargetTriple.str();
       if (!TargetTriple.empty())
index e74c202..e6d4780 100644 (file)
@@ -27,6 +27,7 @@
 #include "llvm/Support/SystemUtils.h"
 #include "llvm/Support/ToolOutputFile.h"
 #include <memory>
+#include <optional>
 using namespace llvm;
 
 cl::OptionCategory AsCat("llvm-as Options");
@@ -120,7 +121,7 @@ int main(int argc, char **argv) {
 
   // Parse the file now...
   SMDiagnostic Err;
-  auto SetDataLayout = [](StringRef) -> Optional<std::string> {
+  auto SetDataLayout = [](StringRef) -> std::optional<std::string> {
     if (ClDataLayout.empty())
       return std::nullopt;
     return ClDataLayout;
index b536c98..2608710 100644 (file)
@@ -32,6 +32,7 @@
 #include "llvm/Support/WithColor.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Transforms/Utils/Cloning.h"
+#include <optional>
 
 extern cl::OptionCategory LLVMReduceOptions;
 static cl::opt<std::string> TargetTriple("mtriple",
@@ -407,7 +408,7 @@ parseReducerWorkItem(const char *ToolName, StringRef Filename,
         createMIRParser(std::move(FileOrErr.get()), Ctxt);
 
     auto SetDataLayout =
-        [&](StringRef DataLayoutTargetTriple) -> Optional<std::string> {
+        [&](StringRef DataLayoutTargetTriple) -> std::optional<std::string> {
       // If we are supposed to override the target triple, do so now.
       std::string IRTargetTriple = DataLayoutTargetTriple.str();
       if (!TargetTriple.empty())
index 749bc67..a90469c 100644 (file)
@@ -57,6 +57,7 @@
 #include "llvm/Transforms/Utils/Debugify.h"
 #include <algorithm>
 #include <memory>
+#include <optional>
 using namespace llvm;
 using namespace opt_tool;
 
@@ -513,7 +514,7 @@ int main(int argc, char **argv) {
   std::unique_ptr<ToolOutputFile> RemarksFile = std::move(*RemarksFileOrErr);
 
   // Load the input module...
-  auto SetDataLayout = [](StringRef) -> Optional<std::string> {
+  auto SetDataLayout = [](StringRef) -> std::optional<std::string> {
     if (ClDataLayout.empty())
       return std::nullopt;
     return ClDataLayout;