Index: lib/CrossTU/CrossTranslationUnit.cpp =================================================================== --- lib/CrossTU/CrossTranslationUnit.cpp +++ lib/CrossTU/CrossTranslationUnit.cpp @@ -150,6 +150,7 @@ 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!"); const std::string LookupFnName = getLookupName(FD); if (LookupFnName.empty()) @@ -245,6 +246,8 @@ llvm::Expected CrossTranslationUnitContext::importDefinition(const FunctionDecl *FD) { + assert(FD->hasBody() && "Functions to be imported should have body."); + ASTImporter &Importer = getOrCreateASTImporter(FD->getASTContext()); auto *ToDecl = cast(Importer.Import(const_cast(FD)));