diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-04-27 17:26:08 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2016-04-27 17:26:08 +0000 |
commit | 3a947631019015b5d149a5afbba6914d56ca05e7 (patch) | |
tree | 65bb8b65c3333b5c60667be60f42714835054473 /clang/lib/Sema/SemaExpr.cpp | |
parent | 7efdca5622cfd472ccca6fd2b0b830e526abbd48 (diff) | |
download | bcm5719-llvm-3a947631019015b5d149a5afbba6914d56ca05e7.tar.gz bcm5719-llvm-3a947631019015b5d149a5afbba6914d56ca05e7.zip |
Revert r267691, it caused PR27535.
llvm-svn: 267744
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 065c236d6cc..0f47e9e0994 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -13011,7 +13011,17 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, UndefinedButUsed.insert(std::make_pair(Func->getCanonicalDecl(), Loc)); } - Func->markUsed(Context); + // Normally the most current decl is marked used while processing the use and + // any subsequent decls are marked used by decl merging. This fails with + // template instantiation since marking can happen at the end of the file + // and, because of the two phase lookup, this function is called with at + // decl in the middle of a decl chain. We loop to maintain the invariant + // that once a decl is used, all decls after it are also used. + for (FunctionDecl *F = Func->getMostRecentDecl();; F = F->getPreviousDecl()) { + F->markUsed(Context); + if (F == Func) + break; + } } static void |