Author: rjmccall
Date: Tue Mar 16 16:50:59 2010
New Revision: 98685
URL: http://llvm.org/viewvc/llvm-project?rev=98685&view=rev
Log:
Forgot the testcases.
Added:
cfe/trunk/test/Sema/warn-shadow.c
cfe/trunk/test/SemaCXX/warn-shadow.cpp
Added: cfe/trunk/test/Sema/warn-shadow.c
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-shadow.c?rev=98685&view=auto
==============================================================================
--- cfe/trunk/test/Sema/warn-shadow.c (added)
+++ cfe/trunk/test/Sema/warn-shadow.c Tue Mar 16 16:50:59 2010
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -Wshadow %s
+
+int i; // expected-note {{previous declaration is here}}
+
+void foo() {
+ int pass1;
+ int i; // expected-warning {{declaration shadows a variable in the
global scope}} \
+ // expected-note {{previous declaration is here}}
+ {
+ int pass2;
+ int i; // expected-warning {{declaration shadows a local variable}} \
+ // expected-note {{previous declaration is here}}
+ {
+ int pass3;
+ int i; // expected-warning {{declaration shadows a local variable}}
+ }
+ }
+
+ int __sync_fetch_and_add; // expected-warning {{declaration shadows a global
built-in function}}
+}
Added: cfe/trunk/test/SemaCXX/warn-shadow.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-shadow.cpp?rev=98685&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-shadow.cpp (added)
+++ cfe/trunk/test/SemaCXX/warn-shadow.cpp Tue Mar 16 16:50:59 2010
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -Wshadow %s
+
+namespace {
+ int i; // expected-note {{previous declaration is here}}
+}
+
+namespace one {
+namespace two {
+ int j; // expected-note {{previous declaration is here}}
+}
+}
+
+namespace xx {
+ int m;
+}
+namespace yy {
+ int m;
+}
+
+using namespace one::two;
+using namespace xx;
+using namespace yy;
+
+void foo() {
+ int i; // expected-warning {{declaration shadows a variable in namespace
'<anonymous>'}}
+ int j; // expected-warning {{declaration shadows a variable in namespace
'one::two'}}
+ int m;
+}
+
+class A {
+ static int data; // expected-note {{previous declaration}}
+ int field; // expected-note {{previous declaration}}
+
+ void test() {
+ char *field; // expected-warning {{declaration shadows a field of 'A'}}
+ char *data; // expected-warning {{declaration shadows a static data member
of 'A'}}
+ }
+};
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits