summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-06-19 23:52:42 +0000
committerDouglas Gregor <dgregor@apple.com>2009-06-19 23:52:42 +0000
commitc9c02ed8f499f005b5a8e68f1ecd87401f90daa9 (patch)
tree003b2f568adda31fe1d7fe677e48f2ed126f4dc5 /clang/test
parent724f825f96ab44280a5864e67e8151a7792e393d (diff)
downloadbcm5719-llvm-c9c02ed8f499f005b5a8e68f1ecd87401f90daa9.tar.gz
bcm5719-llvm-c9c02ed8f499f005b5a8e68f1ecd87401f90daa9.zip
Keep track of when declarations are "used" according to C and
C++. This logic is required to trigger implicit instantiation of function templates and member functions of class templates, which will be implemented separately. This commit includes support for -Wunused-parameter, printing warnings for named parameters that are not used within a function/Objective-C method/block. Fixes <rdar://problem/6505209>. llvm-svn: 73797
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/warn-unused-parameters.c13
-rw-r--r--clang/test/SemaObjC/warn-unused-parameters.m11
2 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/Sema/warn-unused-parameters.c b/clang/test/Sema/warn-unused-parameters.c
new file mode 100644
index 00000000000..115bbab8151
--- /dev/null
+++ b/clang/test/Sema/warn-unused-parameters.c
@@ -0,0 +1,13 @@
+// RUN: clang -fsyntax-only -Wunused-parameter %s -Xclang -verify
+
+int f0(int x,
+ int y, // expected-warning{{unused}}
+ int z __attribute__((unused))) {
+ return x;
+}
+
+void f1() {
+ (void)^(int x,
+ int y, // expected-warning{{unused}}
+ int z __attribute__((unused))) { return x; };
+} \ No newline at end of file
diff --git a/clang/test/SemaObjC/warn-unused-parameters.m b/clang/test/SemaObjC/warn-unused-parameters.m
new file mode 100644
index 00000000000..618dc3ff596
--- /dev/null
+++ b/clang/test/SemaObjC/warn-unused-parameters.m
@@ -0,0 +1,11 @@
+// RUN: clang -fsyntax-only -Wunused -Xclang -verify %s
+
+@interface foo
+- (int)meth: (int)x: (int)y: (int)z ;
+@end
+
+@implementation foo
+- (int) meth: (int)x:
+ (int)y: // expected-warning{{unused}}
+ (int) __attribute__((unused))z { return x; }
+@end
OpenPOWER on IntegriCloud