[llvm-branch-commits] [cfe-branch] r118584 - in /cfe/branches/Apple/whitney: lib/Sema/SemaAttr.cpp test/SemaCXX/warn-unused-variables.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 9 09:33:09 PST 2010
Author: ddunbar
Date: Tue Nov 9 11:33:09 2010
New Revision: 118584
URL: http://llvm.org/viewvc/llvm-project?rev=118584&view=rev
Log:
Merge r118500:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Tue Nov 9 14:57:47 2010 +0000
Make #pragma unused work for static local variables.
Modified:
cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp
cfe/branches/Apple/whitney/test/SemaCXX/warn-unused-variables.cpp
Modified: cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp?rev=118584&r1=118583&r2=118584&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaAttr.cpp Tue Nov 9 11:33:09 2010
@@ -282,7 +282,7 @@
}
VarDecl *VD = Lookup.getAsSingle<VarDecl>();
- if (!VD || !VD->hasLocalStorage()) {
+ if (!VD || !(VD->hasLocalStorage() || VD->isStaticLocal())) {
Diag(PragmaLoc, diag::warn_pragma_unused_expected_localvar)
<< Name << SourceRange(Tok.getLocation());
continue;
Modified: cfe/branches/Apple/whitney/test/SemaCXX/warn-unused-variables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaCXX/warn-unused-variables.cpp?rev=118584&r1=118583&r2=118584&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaCXX/warn-unused-variables.cpp (original)
+++ cfe/branches/Apple/whitney/test/SemaCXX/warn-unused-variables.cpp Tue Nov 9 11:33:09 2010
@@ -59,3 +59,9 @@
X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
}
}
+
+void unused_local_static() {
+ static int x = 0;
+ static int y = 0; // expected-warning{{unused variable 'y'}}
+#pragma unused(x)
+}
More information about the llvm-branch-commits
mailing list