diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 8d2884f75071..2496f72bea9b 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -2480,7 +2480,10 @@ static inline bool compLocDecl(std::pair L, void ASTUnit::addFileLevelDecl(Decl *D) { assert(D); - assert(!D->isFromASTFile() && "This is only for local decl"); + + // We only care about local declarations. + if (D->isFromASTFile()) + return; SourceManager &SM = *SourceMgr; SourceLocation Loc = D->getLocation(); diff --git a/clang/test/Index/reparse-instantiate.cpp b/clang/test/Index/reparse-instantiate.cpp new file mode 100644 index 000000000000..84e58605c48f --- /dev/null +++ b/clang/test/Index/reparse-instantiate.cpp @@ -0,0 +1,7 @@ +int main() +{ + return 0; +} + +// RUN: c-index-test -write-pch %t.pch -fno-delayed-template-parsing -x c++-header %S/Inputs/reparse-instantiate.h +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -fno-delayed-template-parsing -I %S/Inputs -include %t %s