r316885 - [analyzer] Handle ObjC messages conservatively in CallDescription

Gabor Horvath via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 01:47:13 PDT 2017


Author: xazax
Date: Mon Oct 30 01:47:13 2017
New Revision: 316885

URL: http://llvm.org/viewvc/llvm-project?rev=316885&view=rev
Log:
[analyzer] Handle ObjC messages conservatively in CallDescription

Differential Revision: https://reviews.llvm.org/D37470

Added:
    cfe/trunk/test/Analysis/block-in-critical-section.m
Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp?rev=316885&r1=316884&r2=316885&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp Mon Oct 30 01:47:13 2017
@@ -211,7 +211,9 @@ ProgramPoint CallEvent::getProgramPoint(
 }
 
 bool CallEvent::isCalled(const CallDescription &CD) const {
-  assert(getKind() != CE_ObjCMessage && "Obj-C methods are not supported");
+  // FIXME: Add ObjC Message support.
+  if (getKind() == CE_ObjCMessage)
+    return false;
   if (!CD.IsLookupDone) {
     CD.IsLookupDone = true;
     CD.II = &getState()->getStateManager().getContext().Idents.get(CD.FuncName);

Added: cfe/trunk/test/Analysis/block-in-critical-section.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/block-in-critical-section.m?rev=316885&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/block-in-critical-section.m (added)
+++ cfe/trunk/test/Analysis/block-in-critical-section.m Mon Oct 30 01:47:13 2017
@@ -0,0 +1,9 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.BlockInCriticalSection -verify -Wno-objc-root-class %s
+
+ at interface SomeClass
+-(void)someMethod;
+ at end
+
+void shouldNotCrash(SomeClass *o) {
+  [o someMethod];
+}




More information about the cfe-commits mailing list