aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Checker/ObjCAtSyncChecker.cpp8
-rw-r--r--test/Analysis/misc-ps.m14
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/Checker/ObjCAtSyncChecker.cpp b/lib/Checker/ObjCAtSyncChecker.cpp
index dc2e664e05..41580955a9 100644
--- a/lib/Checker/ObjCAtSyncChecker.cpp
+++ b/lib/Checker/ObjCAtSyncChecker.cpp
@@ -75,13 +75,15 @@ void ObjCAtSyncChecker::PreVisitObjCAtSynchronizedStmt(CheckerContext &C,
Ex);
C.EmitReport(report);
+ return;
}
}
- // From this point forward, we know that the mutex is null.
- C.addTransition(nullState);
+ // Don't add a transition for 'nullState'. If the value is
+ // under-constrained to be null or non-null, assume it is non-null
+ // afterwards.
}
if (notNullState)
C.addTransition(notNullState);
}
-
+
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index bb70c90e6a..2409be351c 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -1110,6 +1110,20 @@ void rdar6351970_c() {
@synchronized(x) {} // expected-warning{{Uninitialized value used as mutex for @synchronized}}
}
+@interface Rdar8578650
+- (id) foo8578650;
+@end
+
+void rdar8578650(id x) {
+ @synchronized (x) {
+ [x foo8578650];
+ }
+ // At this point we should assume that 'x' is not nil, not
+ // the inverse.
+ @synchronized (x) { // no-warning
+ }
+}
+
// <rdar://problem/6352035> rule request: direct structure member access null pointer dereference
@interface RDar6352035 {
int c;