diff options
| author | Gabor Marton <martongabesz@gmail.com> | 2018-12-07 12:21:43 +0000 |
|---|---|---|
| committer | Gabor Marton <martongabesz@gmail.com> | 2018-12-07 12:21:43 +0000 |
| commit | b7f30dda39a47b2d566d7cc8a9d7a91af7efa693 (patch) | |
| tree | d1e6ad343d143366590b58d9e94c45c8a1f0dec1 /clang/lib/CrossTU/CrossTranslationUnit.cpp | |
| parent | ca29c271d2b951b125b7f97264ca7b927db0b1cf (diff) | |
| download | bcm5719-llvm-b7f30dda39a47b2d566d7cc8a9d7a91af7efa693.tar.gz bcm5719-llvm-b7f30dda39a47b2d566d7cc8a9d7a91af7efa693.zip | |
[CTU] Add asserts to protect invariants
Reviewers: xazax.hun, a_sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Differential Revision: https://reviews.llvm.org/D55132
llvm-svn: 348586
Diffstat (limited to 'clang/lib/CrossTU/CrossTranslationUnit.cpp')
| -rw-r--r-- | clang/lib/CrossTU/CrossTranslationUnit.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp index 08c9d99ec97..97563b05b00 100644 --- a/clang/lib/CrossTU/CrossTranslationUnit.cpp +++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp @@ -160,6 +160,7 @@ llvm::Expected<const FunctionDecl *> CrossTranslationUnitContext::getCrossTUDefinition(const FunctionDecl *FD, StringRef CrossTUDir, StringRef IndexName) { + assert(FD && "FD is missing, bad call to this function!"); assert(!FD->hasBody() && "FD has a definition in current translation unit!"); ++NumGetCTUCalled; const std::string LookupFnName = getLookupName(FD); @@ -258,6 +259,8 @@ llvm::Expected<ASTUnit *> CrossTranslationUnitContext::loadExternalAST( llvm::Expected<const FunctionDecl *> CrossTranslationUnitContext::importDefinition(const FunctionDecl *FD) { + assert(FD->hasBody() && "Functions to be imported should have body."); + ASTImporter &Importer = getOrCreateASTImporter(FD->getASTContext()); auto *ToDecl = cast<FunctionDecl>(Importer.Import(const_cast<FunctionDecl *>(FD))); |

