]> granicus.if.org Git - clang/commitdiff
Change ExprEngine::shouldInlineDecl() to be defensive in checking if the CFG of the...
authorTed Kremenek <kremenek@apple.com>
Tue, 17 Apr 2012 01:36:03 +0000 (01:36 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 17 Apr 2012 01:36:03 +0000 (01:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154896 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp

index b99bd5441e413bbf007ddee7a6e0a35ddf0b6dc3..b9f4e153d7e1e8763cf45a12c6b5b133560e2903 100644 (file)
@@ -134,6 +134,11 @@ bool ExprEngine::shouldInlineDecl(const FunctionDecl *FD, ExplodedNode *Pred) {
   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;