diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-11 20:08:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-11 20:08:03 +0000 |
commit | ab0e8873c37bfcd292a17dafc61d6baff7caf30d (patch) | |
tree | 598f590713dca82042d9de659a8463ea760966ae | |
parent | e64941280877d065a27e8cefd2a9038256d0e3ac (diff) |
Fix rdar://7126285: don't warn on unused ObjC property access
that uses "dot syntax" since it might have a side effect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78704 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/Expr.cpp | 1 | ||||
-rw-r--r-- | test/SemaObjC/unused.m | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index ce8bb516c0..6aa971112d 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -540,6 +540,7 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, return false; } case ObjCMessageExprClass: + case ObjCKVCRefExprClass: // Dot syntax for message send. return false; case StmtExprClass: { // Statement exprs don't logically have side effects themselves, but are diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m index 88c6f1054c..d4660cdc00 100644 --- a/test/SemaObjC/unused.m +++ b/test/SemaObjC/unused.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -fsyntax-only +// RUN: clang-cc %s -verify -Wunused -fsyntax-only #include <stdio.h> @interface Greeter @@ -11,6 +11,21 @@ } @end + + + +@interface NSObject @end +@interface NSString : NSObject +- (int)length; +@end + +void test() { + // No unused warning: rdar://7126285 + @"pointless example call for test purposes".length; +} + + + int main (void) { [Greeter hello]; return 0; |