FunctionSummary.cpp revision 234287
1//== FunctionSummary.h - Stores summaries of functions. ------------*- C++ -*-//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines a summary of a function gathered/used by static analyzes.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h"
15using namespace clang;
16using namespace ento;
17
18FunctionSummariesTy::~FunctionSummariesTy() {
19  for (MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I) {
20    delete(I->second);
21  }
22}
23
24unsigned FunctionSummariesTy::getTotalNumBasicBlocks() {
25  unsigned Total = 0;
26  for (MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I) {
27    Total += I->second->TotalBasicBlocks;
28  }
29  return Total;
30}
31
32unsigned FunctionSummariesTy::getTotalNumVisitedBasicBlocks() {
33  unsigned Total = 0;
34  for (MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I) {
35    Total += I->second->VisitedBasicBlocks.count();
36  }
37  return Total;
38}
39