From: Anna Zaks Date: Fri, 1 Jun 2012 23:48:40 +0000 (+0000) Subject: [analyzer] Fix lack of coverage after empty inlined function. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=144e52be486a3906aec90c51b0ac94a30313152e;p=clang [analyzer] Fix lack of coverage after empty inlined function. 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 --- diff --git a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index cab812ffdc..a3486e7fbf 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -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(), diff --git a/test/Analysis/coverage.c b/test/Analysis/coverage.c index 73d78da186..811691391e 100644 --- a/test/Analysis/coverage.c +++ b/test/Analysis/coverage.c @@ -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}} +}