[clang] 7e6294c - Modernize llvm::Error handling in ExternalASTMerger

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 14 04:59:16 PST 2019


Author: Raphael Isemann
Date: 2019-11-14T13:58:32+01:00
New Revision: 7e6294c056838683f43670c8390ef13df6657e57

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

LOG: Modernize llvm::Error handling in ExternalASTMerger

Added: 
    

Modified: 
    clang/lib/AST/ExternalASTMerger.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index f678c2dd3b59..88bbe90a4e90 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -510,9 +510,7 @@ bool ExternalASTMerger::FindExternalVisibleDeclsByName(const DeclContext *DC,
     Decl *LookupRes = C.first.get();
     ASTImporter *Importer = C.second;
     auto NDOrErr = Importer->Import(LookupRes);
-    assert(NDOrErr);
-    (void)static_cast<bool>(NDOrErr);
-    NamedDecl *ND = cast_or_null<NamedDecl>(*NDOrErr);
+    NamedDecl *ND = cast<NamedDecl>(llvm::cantFail(std::move(NDOrErr)));
     assert(ND);
     // If we don't import specialization, they are not available via lookup
     // because the lookup result is imported TemplateDecl and it does not


        


More information about the cfe-commits mailing list