summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-01-08 19:43:34 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-01-08 19:43:34 +0000
commit820fa707b1d12ffb3050fd1a9845b0b9d2709abe (patch)
tree483a8fd8cbcd945d8b9ad20f3f66009d18e42c38 /clang/lib/Sema/Sema.cpp
parent77aa25090a7d628fee62aef95c343ec4cd546618 (diff)
downloadbcm5719-llvm-820fa707b1d12ffb3050fd1a9845b0b9d2709abe.tar.gz
bcm5719-llvm-820fa707b1d12ffb3050fd1a9845b0b9d2709abe.zip
Mark all subsequent decls used.
In the source static void f(); static void f(); template<typename T> static void g() { f(); } static void f() { } void h() { g<int>(); } the call to f refers to the second decl, but it is only marked used at the end of the translation unit during instantiation, after the third f decl has been linked in. With this patch we mark all subsequent decls used, so that it is easy to check if a symbol is used or not. llvm-svn: 171888
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 66861ae663a..8f9e1a9a0f9 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -328,11 +328,7 @@ CastKind Sema::ScalarTypeToBooleanCastKind(QualType ScalarTy) {
/// \brief Used to prune the decls of Sema's UnusedFileScopedDecls vector.
static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D) {
- // Template instantiation can happen at the end of the translation unit
- // and it sets the canonical (first) decl to used. Normal uses set the last
- // decl at the time to used and subsequent decl inherit the flag. The net
- // result is that we need to check both ends of the decl chain.
- if (D->isUsed() || D->getMostRecentDecl()->isUsed())
+ if (D->getMostRecentDecl()->isUsed())
return true;
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
OpenPOWER on IntegriCloud