[cfe-commits] r157859 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp test/Analysis/coverage.c

Anna Zaks ganna at apple.com
Fri Jun 1 16:48:41 PDT 2012


Author: zaks
Date: Fri Jun  1 18:48:40 2012
New Revision: 157859

URL: http://llvm.org/viewvc/llvm-project?rev=157859&view=rev
Log:
[analyzer] Fix lack of coverage after empty inlined function.

We should not stop exploring the path after we return from an empty
function.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
    cfe/trunk/test/Analysis/coverage.c

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp?rev=157859&r1=157858&r2=157859&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Fri Jun  1 18:48:40 2012
@@ -159,6 +159,8 @@
     removeDead(BindedRetNode, CleanedNodes, 0, callerCtx, LastSt,
                ProgramPoint::PostStmtPurgeDeadSymbolsKind);
     currentBuilderContext = 0;
+  } else {
+    CleanedNodes.Add(CEBNode);
   }
 
   for (ExplodedNodeSet::iterator I = CleanedNodes.begin(),

Modified: cfe/trunk/test/Analysis/coverage.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/coverage.c?rev=157859&r1=157858&r2=157859&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/coverage.c (original)
+++ cfe/trunk/test/Analysis/coverage.c Fri Jun  1 18:48:40 2012
@@ -92,3 +92,11 @@
   function_which_gives_up_settonull(&x);
   y = (*x);  // no warning
 }
+
+static void empty_function(){
+}
+int use_empty_function(int x) {
+    x = 0;
+    empty_function();
+    return 5/x; //expected-warning {{Division by zero}}
+}





More information about the cfe-commits mailing list