]> granicus.if.org Git - clang/commitdiff
[analyzer] Fix lack of coverage after empty inlined function.
authorAnna Zaks <ganna@apple.com>
Fri, 1 Jun 2012 23:48:40 +0000 (23:48 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 1 Jun 2012 23:48:40 +0000 (23:48 +0000)
We should not stop exploring the path after we return from an empty
function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157859 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/coverage.c

index cab812ffdcf93911c7c36a0d6cb61af4d84426dd..a3486e7fbfd7ce1545cca0692e7459b7efd5473a 100644 (file)
@@ -159,6 +159,8 @@ void ExprEngine::processCallExit(ExplodedNode *CEBNode) {
     removeDead(BindedRetNode, CleanedNodes, 0, callerCtx, LastSt,
                ProgramPoint::PostStmtPurgeDeadSymbolsKind);
     currentBuilderContext = 0;
+  } else {
+    CleanedNodes.Add(CEBNode);
   }
 
   for (ExplodedNodeSet::iterator I = CleanedNodes.begin(),
index 73d78da1864494c806e7361a1b2875f60fd89f4f..811691391eb1b4e2a53fd3bff071b2234c7b9a3f 100644 (file)
@@ -92,3 +92,11 @@ void coverage9(int *x) {
   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}}
+}