[clang] 17d779b - [AST] Use std::optional in ASTImporter.cpp (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 9 22:17:52 PST 2022


Author: Kazu Hirata
Date: 2022-12-09T22:17:46-08:00
New Revision: 17d779be76d9597fe13478392b266543761fedca

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

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 5fb289b9c9e4c..14d2d4a58eb46 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -68,6 +68,7 @@
 #include <cassert>
 #include <cstddef>
 #include <memory>
+#include <optional>
 #include <type_traits>
 #include <utility>
 
@@ -3981,7 +3982,7 @@ static FriendCountAndPosition getFriendCountAndPosition(
     const FriendDecl *FD,
     llvm::function_ref<T(const FriendDecl *)> GetCanTypeOrDecl) {
   unsigned int FriendCount = 0;
-  llvm::Optional<unsigned int> FriendPosition;
+  std::optional<unsigned int> FriendPosition;
   const auto *RD = cast<CXXRecordDecl>(FD->getLexicalDeclContext());
 
   T TypeOrDecl = GetCanTypeOrDecl(FD);


        


More information about the cfe-commits mailing list