aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Frontend/ASTUnit.cpp5
-rw-r--r--test/Index/reparse-instantiate.cpp7
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 8d2884f750..2496f72bea 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -2480,7 +2480,10 @@ static inline bool compLocDecl(std::pair<unsigned, Decl *> 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/test/Index/reparse-instantiate.cpp b/test/Index/reparse-instantiate.cpp
new file mode 100644
index 0000000000..84e58605c4
--- /dev/null
+++ b/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