[PATCH] D55280: [CTU] Make loadExternalAST return with non nullptr on success
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 7 06:09:00 PST 2019
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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55280.180479.patch
Type: text/x-patch
Size: 1516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190107/7dabdc4e/attachment-0001.bin>
More information about the cfe-commits
mailing list