[clang] f655cb0 - [ExtractAPI] Use std::optional in ExtractAPIConsumer.cpp (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 9 23:03:16 PST 2022


Author: Kazu Hirata
Date: 2022-12-09T23:03:10-08:00
New Revision: f655cb0f580ffab1a7d2ffb73043661bba449a44

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

LOG: [ExtractAPI] Use std::optional in ExtractAPIConsumer.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: 
    clang/lib/ExtractAPI/ExtractAPIConsumer.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
index 7c56818156e3..5f185d0bd6aa 100644
--- a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
+++ b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
@@ -47,6 +47,7 @@
 #include "llvm/Support/Regex.h"
 #include "llvm/Support/raw_ostream.h"
 #include <memory>
+#include <optional>
 #include <utility>
 
 using namespace clang;
@@ -61,9 +62,9 @@ StringRef getTypedefName(const TagDecl *Decl) {
   return {};
 }
 
-Optional<std::string> getRelativeIncludeName(const CompilerInstance &CI,
-                                             StringRef File,
-                                             bool *IsQuoted = nullptr) {
+std::optional<std::string> getRelativeIncludeName(const CompilerInstance &CI,
+                                                  StringRef File,
+                                                  bool *IsQuoted = nullptr) {
   assert(CI.hasFileManager() &&
          "CompilerInstance does not have a FileNamager!");
 


        


More information about the cfe-commits mailing list