summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorGabor Marton <martongabesz@gmail.com>2018-12-07 16:05:58 +0000
committerGabor Marton <martongabesz@gmail.com>2018-12-07 16:05:58 +0000
commitb87251d0bb9309113f234e020720d3505938e1b1 (patch)
tree3fc2d8ae62cc72b038a75d80f53a2736bc8f6d65 /clang/lib
parent3af4ae9735d16d07fa1321ef3bd25ae86dfc15a3 (diff)
downloadbcm5719-llvm-b87251d0bb9309113f234e020720d3505938e1b1.tar.gz
bcm5719-llvm-b87251d0bb9309113f234e020720d3505938e1b1.zip
[CTU] Add more lit tests and better error handling
Summary: Adding some more CTU list tests. E.g. to check if a construct is unsupported. We also slightly modify the handling of the return value of the `Import` function from ASTImporter. Reviewers: xazax.hun, balazske, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55131 llvm-svn: 348605
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CrossTU/CrossTranslationUnit.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp
index 7d4f0ec9b42..ec8ac6498ff 100644
--- a/clang/lib/CrossTU/CrossTranslationUnit.cpp
+++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp
@@ -269,7 +269,9 @@ CrossTranslationUnitContext::importDefinition(const FunctionDecl *FD) {
ASTImporter &Importer = getOrCreateASTImporter(FD->getASTContext());
auto *ToDecl =
- cast<FunctionDecl>(Importer.Import(const_cast<FunctionDecl *>(FD)));
+ cast_or_null<FunctionDecl>(Importer.Import(const_cast<FunctionDecl *>(FD)));
+ if (!ToDecl)
+ return llvm::make_error<IndexError>(index_error_code::failed_import);
assert(ToDecl->hasBody());
assert(FD->hasBody() && "Functions already imported should have body.");
++NumGetCTUSuccess;
OpenPOWER on IntegriCloud