[llvm] 72b861b - [OpenMP] Use std::optional in OMPIRBuilder.h (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 10 08:21:09 PST 2022


Author: Kazu Hirata
Date: 2022-12-10T08:21:04-08:00
New Revision: 72b861be7c45155847ef490cdef858cc7a9180f8

URL: https://github.com/llvm/llvm-project/commit/72b861be7c45155847ef490cdef858cc7a9180f8
DIFF: https://github.com/llvm/llvm-project/commit/72b861be7c45155847ef490cdef858cc7a9180f8.diff

LOG: [OpenMP] Use std::optional in OMPIRBuilder.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/Frontend/OpenMP/OMPIRBuilder.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index f029e32e85f9..a2b23d220060 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/Allocator.h"
 #include <forward_list>
 #include <map>
+#include <optional>
 
 namespace llvm {
 class CanonicalLoopInfo;
@@ -82,20 +83,20 @@ class OpenMPIRBuilderConfig {
 public:
   /// Flag for specifying if the compilation is done for embedded device code
   /// or host code.
-  Optional<bool> IsEmbedded;
+  std::optional<bool> IsEmbedded;
 
   /// Flag for specifying if the compilation is done for an offloading target,
   /// like GPU.
-  Optional<bool> IsTargetCodegen;
+  std::optional<bool> IsTargetCodegen;
 
   /// Flag for specifying weather a requires unified_shared_memory
   /// directive is present or not.
-  Optional<bool> HasRequiresUnifiedSharedMemory;
+  std::optional<bool> HasRequiresUnifiedSharedMemory;
 
   /// First separator used between the initial two parts of a name.
-  Optional<StringRef> FirstSeparator;
+  std::optional<StringRef> FirstSeparator;
   /// Separator used between all of the rest consecutive parts of s name
-  Optional<StringRef> Separator;
+  std::optional<StringRef> Separator;
 
   OpenMPIRBuilderConfig() {}
   OpenMPIRBuilderConfig(bool IsEmbedded, bool IsTargetCodegen,


        


More information about the llvm-commits mailing list