Add check for UnknownVals for mutexes in ObjCAtSyncChecker. Fixes crash reported in PR 8458.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117300 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/ObjCAtSyncChecker.cpp b/lib/Checker/ObjCAtSyncChecker.cpp
index 4158095..f9a3686 100644
--- a/lib/Checker/ObjCAtSyncChecker.cpp
+++ b/lib/Checker/ObjCAtSyncChecker.cpp
@@ -57,6 +57,9 @@
return;
}
+ if (V.isUnknown())
+ return;
+
// Check for null mutexes.
const GRState *notNullState, *nullState;
llvm::tie(notNullState, nullState) = state->Assume(cast<DefinedSVal>(V));
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index 2409be3..52dd7e1 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -1149,3 +1149,13 @@
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
+}
+