summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-12-21 21:59:39 +0000
committerTed Kremenek <kremenek@apple.com>2012-12-21 21:59:39 +0000
commit44c2a2a26ecdd47d2933ad58a6569a0f25802d65 (patch)
treecb95abd35a447f9aa1e8787be992b74860289941 /clang/test/SemaObjC
parent01a33f82d293cd2fa00021624be917b177a60459 (diff)
downloadbcm5719-llvm-44c2a2a26ecdd47d2933ad58a6569a0f25802d65.tar.gz
bcm5719-llvm-44c2a2a26ecdd47d2933ad58a6569a0f25802d65.zip
Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().
Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses in boxed expressions for purpose of classification. In other words, both @42 and @(42) should be classified as numeric literals. llvm-svn: 170931
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r--clang/test/SemaObjC/arc.m8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m
index 08216b6d80e..bffcd4bbde2 100644
--- a/clang/test/SemaObjC/arc.m
+++ b/clang/test/SemaObjC/arc.m
@@ -740,11 +740,15 @@ void rdar12569201(id key, id value) {
__weak id y = @{ key : value }; // expected-warning {{assigning dictionary literal to a weak variable; object will be released after assignment}}
__weak id z = @[ value ]; // expected-warning {{assigning array literal to a weak variable; object will be released after assignment}}
__weak id b = ^() {}; // expected-warning {{assigning block literal to a weak variable; object will be released after assignment}}
- __weak id e = @(42); // expected-warning {{assigning boxed expression to a weak variable; object will be released after assignment}}
+ __weak id n = @42; // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
+ __weak id e = @(42); // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
+ __weak id m = @(41 + 1); // expected-warning {{assigning boxed expression to a weak variable; object will be released after assignment}}
// Assignments.
y = @{ key : value }; // expected-warning {{assigning dictionary literal to a weak variable; object will be released after assignment}}
z = @[ value ]; // expected-warning {{assigning array literal to a weak variable; object will be released after assignment}}
b = ^() {}; // expected-warning {{assigning block literal to a weak variable; object will be released after assignment}}
- e = @(42); // expected-warning {{assigning boxed expression to a weak variable; object will be released after assignment}}
+ n = @42; // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
+ e = @(42); // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
+ m = @(41 + 1); // expected-warning {{assigning boxed expression to a weak variable; object will be released after assignment}}
}
OpenPOWER on IntegriCloud