Index: include/clang/CrossTU/CrossTranslationUnit.h =================================================================== --- include/clang/CrossTU/CrossTranslationUnit.h +++ include/clang/CrossTU/CrossTranslationUnit.h @@ -40,7 +40,6 @@ multiple_definitions, missing_definition, failed_import, - failed_to_get_external_ast, failed_to_generate_usr }; @@ -118,8 +117,8 @@ /// \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. The pointer should not be a nullptr. /// /// Note that the AST files should also be in the \p CrossTUDir. llvm::Expected loadExternalAST(StringRef LookupName, Index: lib/CrossTU/CrossTranslationUnit.cpp =================================================================== --- lib/CrossTU/CrossTranslationUnit.cpp +++ lib/CrossTU/CrossTranslationUnit.cpp @@ -51,8 +51,6 @@ return "Missing definition from the index file."; case index_error_code::failed_import: return "Failed to import the definition."; - case index_error_code::failed_to_get_external_ast: - return "Failed to load external AST source."; case index_error_code::failed_to_generate_usr: return "Failed to generate USR."; } @@ -160,9 +158,6 @@ if (!ASTUnitOrError) return ASTUnitOrError.takeError(); ASTUnit *Unit = *ASTUnitOrError; - if (!Unit) - return llvm::make_error( - index_error_code::failed_to_get_external_ast); assert(&Unit->getFileManager() == &Unit->getASTContext().getSourceManager().getFileManager()); @@ -240,6 +235,7 @@ } else { Unit = FnUnitCacheEntry->second; } + assert(Unit); return Unit; }