From: Anna Zaks Date: Thu, 5 Apr 2012 02:10:17 +0000 (+0000) Subject: [analyzer] Add a coverage calculation to FunctionSummaries. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd863466b97cee866370bc6ff75370628ab01d37;p=clang [analyzer] Add a coverage calculation to FunctionSummaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154076 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h b/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h index e1e15620fa..33943d9f1c 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h @@ -87,8 +87,18 @@ public: return 0; } + /// Get the percentage of the reachable blocks. + unsigned getPercentBlocksReachable(const Decl *D) { + MapTy::const_iterator I = Map.find(D); + if (I != Map.end()) + return ((I->second->VisitedBasicBlocks.count() * 100) / + I->second->TotalBasicBlocks); + return 0; + } + unsigned getTotalNumBasicBlocks(); unsigned getTotalNumVisitedBasicBlocks(); + }; }} // end clang ento namespaces