This revision was automatically updated to reflect the committed changes. Closed by commit rC350521: [CTU] Make loadExternalAST return with non nullptr on success (authored by martong, committed by ).
Changed prior to commit: https://reviews.llvm.org/D55280?vs=176779&id=180479#toc Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55280/new/ https://reviews.llvm.org/D55280 Files: include/clang/CrossTU/CrossTranslationUnit.h lib/CrossTU/CrossTranslationUnit.cpp Index: lib/CrossTU/CrossTranslationUnit.cpp =================================================================== --- lib/CrossTU/CrossTranslationUnit.cpp +++ lib/CrossTU/CrossTranslationUnit.cpp @@ -208,9 +208,6 @@ if (!ASTUnitOrError) return ASTUnitOrError.takeError(); ASTUnit *Unit = *ASTUnitOrError; - if (!Unit) - return llvm::make_error<IndexError>( - index_error_code::failed_to_get_external_ast); assert(&Unit->getFileManager() == &Unit->getASTContext().getSourceManager().getFileManager()); @@ -324,6 +321,9 @@ } else { Unit = FnUnitCacheEntry->second; } + if (!Unit) + return llvm::make_error<IndexError>( + index_error_code::failed_to_get_external_ast); return Unit; } Index: include/clang/CrossTU/CrossTranslationUnit.h =================================================================== --- include/clang/CrossTU/CrossTranslationUnit.h +++ include/clang/CrossTU/CrossTranslationUnit.h @@ -130,8 +130,9 @@ /// \p IndexName. In case the declaration is found in the index the /// corresponding AST file will be loaded. /// - /// \return Returns an ASTUnit that contains the definition of the looked up - /// function. + /// \return Returns a pointer to the ASTUnit that contains the definition of + /// the looked up function or an Error. + /// The returned pointer is never a nullptr. /// /// Note that the AST files should also be in the \p CrossTUDir. llvm::Expected<ASTUnit *> loadExternalAST(StringRef LookupName,
Index: lib/CrossTU/CrossTranslationUnit.cpp =================================================================== --- lib/CrossTU/CrossTranslationUnit.cpp +++ lib/CrossTU/CrossTranslationUnit.cpp @@ -208,9 +208,6 @@ if (!ASTUnitOrError) return ASTUnitOrError.takeError(); ASTUnit *Unit = *ASTUnitOrError; - if (!Unit) - return llvm::make_error<IndexError>( - index_error_code::failed_to_get_external_ast); assert(&Unit->getFileManager() == &Unit->getASTContext().getSourceManager().getFileManager()); @@ -324,6 +321,9 @@ } else { Unit = FnUnitCacheEntry->second; } + if (!Unit) + return llvm::make_error<IndexError>( + index_error_code::failed_to_get_external_ast); return Unit; } Index: include/clang/CrossTU/CrossTranslationUnit.h =================================================================== --- include/clang/CrossTU/CrossTranslationUnit.h +++ include/clang/CrossTU/CrossTranslationUnit.h @@ -130,8 +130,9 @@ /// \p IndexName. In case the declaration is found in the index the /// corresponding AST file will be loaded. /// - /// \return Returns an ASTUnit that contains the definition of the looked up - /// function. + /// \return Returns a pointer to the ASTUnit that contains the definition of + /// the looked up function or an Error. + /// The returned pointer is never a nullptr. /// /// Note that the AST files should also be in the \p CrossTUDir. llvm::Expected<ASTUnit *> loadExternalAST(StringRef LookupName,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits