summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2015-11-24 19:15:11 +0000
committerDevin Coughlin <dcoughlin@apple.com>2015-11-24 19:15:11 +0000
commitc1986638a7375e984a68aa054858deeee8878477 (patch)
tree6334a353ba36ff83ed9e5dd9aaaa43e104aceafc /clang/test/Analysis
parent860e29e0c372fba6d8079664887bf16ada71cefa (diff)
downloadbcm5719-llvm-c1986638a7375e984a68aa054858deeee8878477.tar.gz
bcm5719-llvm-c1986638a7375e984a68aa054858deeee8878477.zip
[analyzer] Pass value expression for inlined defensive checks when binding null to nonnull.
The nullability checker was not suppressing false positives resulting from inlined defensive checks when null was bound to a nonnull variable because it was passing the entire bind statement rather than the value expression to trackNullOrUndefValue(). This commit changes that checker to synactically match on the bind statement to extract the value expression so it can be passed to trackNullOrUndefValue(). rdar://problem/23575439 llvm-svn: 254007
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r--clang/test/Analysis/nullability.mm15
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/test/Analysis/nullability.mm b/clang/test/Analysis/nullability.mm
index 14cfb67e986..2a96431980f 100644
--- a/clang/test/Analysis/nullability.mm
+++ b/clang/test/Analysis/nullability.mm
@@ -238,6 +238,19 @@ Dummy *_Nonnull testDefensiveInlineChecks(Dummy * p) {
case 3: inlinedUnspecified(p); break;
}
if (getRandom())
- takesNonnull(p);
+ takesNonnull(p); // no-warning
+
+ if (getRandom()) {
+ Dummy *_Nonnull varWithInitializer = p; // no-warning
+
+ Dummy *_Nonnull var1WithInitializer = p, // no-warning
+ *_Nonnull var2WithInitializer = p; // no-warning
+ }
+
+ if (getRandom()) {
+ Dummy *_Nonnull varWithoutInitializer;
+ varWithoutInitializer = p; // no-warning
+ }
+
return p;
}
OpenPOWER on IntegriCloud