summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/warn-variable-not-needed.c
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-22 21:56:29 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-22 21:56:29 +0000
commit77c60085afbd50c03ed49129b213de64e209e6d6 (patch)
treea44be54324a2d3fefb6d01d5a6cdc173cf634959 /clang/test/Sema/warn-variable-not-needed.c
parent9041c3bd5be94dfd313365540e348da87a5d9b92 (diff)
downloadbcm5719-llvm-77c60085afbd50c03ed49129b213de64e209e6d6.tar.gz
bcm5719-llvm-77c60085afbd50c03ed49129b213de64e209e6d6.zip
Consider hidden decls for isUsed checks.
This fixes pr17624. A FIXME from Richard Smith: It seems to me that the root cause is that a per-Decl 'used' flag doesn't really make much sense in the way we use it now. I think we should either track whether that particular declaration is used (with isUsed scanning the entire redecl chain), or we should only have one flag for the entire redeclaration chain (perhaps by always looking at the flag on either the most recent decl or the canonical decl). Modeling it as "is this declaration or any previous declaration used" is weird, and requires contortions like the loop at the end of Sema::MarkFunctionReferenced. llvm-svn: 193202
Diffstat (limited to 'clang/test/Sema/warn-variable-not-needed.c')
-rw-r--r--clang/test/Sema/warn-variable-not-needed.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Sema/warn-variable-not-needed.c b/clang/test/Sema/warn-variable-not-needed.c
new file mode 100644
index 00000000000..472ac829899
--- /dev/null
+++ b/clang/test/Sema/warn-variable-not-needed.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
+// expected-no-diagnostics
+
+static int a;
+int bar() {
+ extern int a;
+ return a;
+}
+static int a;
OpenPOWER on IntegriCloud