This fixes pr14691, which I think is a regression from r168519.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171077
91177308-0d34-0410-b5e6-
96231b3b80d8
/// \brief Used to prune the decls of Sema's UnusedFileScopedDecls vector.
static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D) {
- if (D->isUsed())
+ if (D->getMostRecentDecl()->isUsed())
return true;
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
+
+namespace test1 {
+ static void f() {} // expected-warning {{is not needed and will not be emitted}}
+ static void f();
+ template <typename T>
+ void foo() {
+ f();
+ }
+}
+
+namespace test2 {
+ static void f() {}
+ static void f();
+ static void g() { f(); }
+ void h() { g(); }
+}