]> granicus.if.org Git - clang/commitdiff
Add check for UnknownVals for mutexes in ObjCAtSyncChecker. Fixes crash reported...
authorTed Kremenek <kremenek@apple.com>
Mon, 25 Oct 2010 20:20:56 +0000 (20:20 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 25 Oct 2010 20:20:56 +0000 (20:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117300 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/ObjCAtSyncChecker.cpp
test/Analysis/misc-ps.m

index 41580955a9a4fade0e366a799c62f1b31f019acf..f9a3686c01788da8798b32891e9cab964eef09c4 100644 (file)
@@ -57,6 +57,9 @@ void ObjCAtSyncChecker::PreVisitObjCAtSynchronizedStmt(CheckerContext &C,
     return;
   }
 
+  if (V.isUnknown())
+    return;
+
   // Check for null mutexes.
   const GRState *notNullState, *nullState;
   llvm::tie(notNullState, nullState) = state->Assume(cast<DefinedSVal>(V));
index 2409be351c7ace7d0a5e875a2b4ec68e199330a6..52dd7e1defb9e9d098e8bbf2c2a6e84c4e2f1f3e 100644 (file)
@@ -1149,3 +1149,13 @@ void pr8149(void) {
   for (; ({ do { } while (0); 0; });) { }
 }
 
+// PR 8458 - Make sure @synchronized doesn't crash with properties.
+@interface PR8458 {}
+@property(readonly) id lock;
+@end
+
+static
+void __PR8458(PR8458 *x) {
+  @synchronized(x.lock) {} // no-warning
+}
+