[cfe-commits] r154896 - /cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp

Ted Kremenek kremenek at apple.com
Mon Apr 16 18:36:03 PDT 2012


Author: kremenek
Date: Mon Apr 16 20:36:03 2012
New Revision: 154896

URL: http://llvm.org/viewvc/llvm-project?rev=154896&view=rev
Log:
Change ExprEngine::shouldInlineDecl() to be defensive in checking if the CFG of the callee is valid.  Fixes <rdar://problem/11257631>.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp?rev=154896&r1=154895&r2=154896&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Mon Apr 16 20:36:03 2012
@@ -134,6 +134,11 @@
   AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(FD);
   const CFG *CalleeCFG = CalleeADC->getCFG();
 
+  // It is possible that the CFG cannot be constructed.
+  // Be safe, and check if the CalleeCFG is valid.
+  if (!CalleeCFG)
+    return false;
+
   if (getNumberStackFrames(Pred->getLocationContext())
         == AMgr.InlineMaxStackDepth)
     return false;





More information about the cfe-commits mailing list