[llvm] 110fe4f - [IRReader] Convert Optional in DataLayoutCallbackTy to std::optional
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 08:47:44 PST 2022
Author: Krzysztof Parzyszek
Date: 2022-12-07T08:47:25-08:00
New Revision: 110fe4f49561d3695fe5b11a55378b0656a175f7
URL: https://github.com/llvm/llvm-project/commit/110fe4f49561d3695fe5b11a55378b0656a175f7
DIFF: https://github.com/llvm/llvm-project/commit/110fe4f49561d3695fe5b11a55378b0656a175f7.diff
LOG: [IRReader] Convert Optional in DataLayoutCallbackTy to std::optional
Added:
Modified:
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
Removed:
################################################################################
diff --git a/llvm/include/llvm/AsmParser/Parser.h b/llvm/include/llvm/AsmParser/Parser.h
index b567a3e61f527..64ef7035ed13f 100644
--- a/llvm/include/llvm/AsmParser/Parser.h
+++ b/llvm/include/llvm/AsmParser/Parser.h
@@ -13,11 +13,11 @@
#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
diff --git a/llvm/include/llvm/Bitcode/BitcodeReader.h b/llvm/include/llvm/Bitcode/BitcodeReader.h
index 2a49341c8df75..6b4e0278954ae 100644
--- a/llvm/include/llvm/Bitcode/BitcodeReader.h
+++ b/llvm/include/llvm/Bitcode/BitcodeReader.h
@@ -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
diff --git a/llvm/include/llvm/CodeGen/MIRParser/MIRParser.h b/llvm/include/llvm/CodeGen/MIRParser/MIRParser.h
index 5ce10481e8edd..e9ffc51861441 100644
--- a/llvm/include/llvm/CodeGen/MIRParser/MIRParser.h
+++ b/llvm/include/llvm/CodeGen/MIRParser/MIRParser.h
@@ -18,12 +18,12 @@
#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
diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h
index 13f561d2e9be6..766ad2b9fdaad 100644
--- a/llvm/include/llvm/IRReader/IRReader.h
+++ b/llvm/include/llvm/IRReader/IRReader.h
@@ -14,11 +14,11 @@
#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
diff --git a/llvm/lib/IRReader/IRReader.cpp b/llvm/lib/IRReader/IRReader.cpp
index b645e0b766a94..7765c3fbf2df0 100644
--- a/llvm/lib/IRReader/IRReader.cpp
+++ b/llvm/lib/IRReader/IRReader.cpp
@@ -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;
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 26ad6229796a9..b2cb92ad020e6 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -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())
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp
index e74c202ffc970..e6d4780569c31 100644
--- a/llvm/tools/llvm-as/llvm-as.cpp
+++ b/llvm/tools/llvm-as/llvm-as.cpp
@@ -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;
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index b536c98bea93b..26087106fa74f 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -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())
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 749bc671c43ea..a90469c766eb6 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -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;
More information about the llvm-commits
mailing list