ASTConsumer::handleTopLevelDecl will end up getting called for
function template instantiations. Fixes <rdar://problem/10398005> / PR11312.
llvm-svn: 143984
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 8d2884f..2496f72 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -2480,7 +2480,10 @@
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();