[llvm] 2b158c9 - [Target] Use std::optional in CGPassBuilderOption.h (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 18:26:17 PST 2022


Author: Kazu Hirata
Date: 2022-11-27T18:24:40-08:00
New Revision: 2b158c972d297a0d3239c3696e96285300884a38

URL: https://github.com/llvm/llvm-project/commit/2b158c972d297a0d3239c3696e96285300884a38
DIFF: https://github.com/llvm/llvm-project/commit/2b158c972d297a0d3239c3696e96285300884a38.diff

LOG: [Target] Use std::optional in CGPassBuilderOption.h (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/include/llvm/Target/CGPassBuilderOption.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Target/CGPassBuilderOption.h b/llvm/include/llvm/Target/CGPassBuilderOption.h
index 7a6d91061701b..ed0f0064df84c 100644
--- a/llvm/include/llvm/Target/CGPassBuilderOption.h
+++ b/llvm/include/llvm/Target/CGPassBuilderOption.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Target/TargetOptions.h"
+#include <optional>
 
 namespace llvm {
 
@@ -27,8 +28,8 @@ enum class CFLAAType { None, Steensgaard, Andersen, Both };
 // Not one-on-one but mostly corresponding to commandline options in
 // TargetPassConfig.cpp.
 struct CGPassBuilderOption {
-  Optional<bool> OptimizeRegAlloc;
-  Optional<bool> EnableIPRA;
+  std::optional<bool> OptimizeRegAlloc;
+  std::optional<bool> EnableIPRA;
   bool DebugPM = false;
   bool DisableVerify = false;
   bool EnableImplicitNullChecks = false;
@@ -50,11 +51,11 @@ struct CGPassBuilderOption {
   RunOutliner EnableMachineOutliner = RunOutliner::TargetDefault;
   RegAllocType RegAlloc = RegAllocType::Default;
   CFLAAType UseCFLAA = CFLAAType::None;
-  Optional<GlobalISelAbortMode> EnableGlobalISelAbort;
+  std::optional<GlobalISelAbortMode> EnableGlobalISelAbort;
 
-  Optional<bool> VerifyMachineCode;
-  Optional<bool> EnableFastISelOption;
-  Optional<bool> EnableGlobalISelOption;
+  std::optional<bool> VerifyMachineCode;
+  std::optional<bool> EnableFastISelOption;
+  std::optional<bool> EnableGlobalISelOption;
 };
 
 CGPassBuilderOption getCGPassBuilderOption();


        


More information about the llvm-commits mailing list