]> granicus.if.org Git - clang/commitdiff
[analyzer] Add a coverage calculation to FunctionSummaries.
authorAnna Zaks <ganna@apple.com>
Thu, 5 Apr 2012 02:10:17 +0000 (02:10 +0000)
committerAnna Zaks <ganna@apple.com>
Thu, 5 Apr 2012 02:10:17 +0000 (02:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154076 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h

index e1e15620fa3b04ffc69af972f1d6cb4a04edf5b1..33943d9f1cd39ca417a318ff068ebea11d9604f1 100644 (file)
@@ -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