From cd863466b97cee866370bc6ff75370628ab01d37 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Thu, 5 Apr 2012 02:10:17 +0000 Subject: [PATCH] [analyzer] Add a coverage calculation to FunctionSummaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154076 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Core/PathSensitive/FunctionSummary.h | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- 2.40.0