[llvm] 7c421b5 - [Support] Use std::optional in RISCVISAInfo.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 21:48:23 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T21:48:18-08:00
New Revision: 7c421b53d129e120035ab73a4e743f6397066a27

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

LOG: [Support] Use std::optional in RISCVISAInfo.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/Support/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 3dea408c2672..ff9525bd948f 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -17,6 +17,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 #include <array>
+#include <optional>
 #include <string>
 #include <vector>
 
@@ -154,7 +155,8 @@ struct FindByName {
 };
 } // namespace
 
-static Optional<RISCVExtensionVersion> findDefaultVersion(StringRef ExtName) {
+static std::optional<RISCVExtensionVersion>
+findDefaultVersion(StringRef ExtName) {
   // Find default version of an extension.
   // TODO: We might set default version based on profile or ISA spec.
   for (auto &ExtInfo : {makeArrayRef(SupportedExtensions),
@@ -202,7 +204,8 @@ static StringRef getExtensionType(StringRef Ext) {
   return StringRef();
 }
 
-static Optional<RISCVExtensionVersion> isExperimentalExtension(StringRef Ext) {
+static std::optional<RISCVExtensionVersion>
+isExperimentalExtension(StringRef Ext) {
   auto ExtIterator =
       llvm::find_if(SupportedExperimentalExtensions, FindByName(Ext));
   if (ExtIterator == std::end(SupportedExperimentalExtensions))


        


More information about the llvm-commits mailing list