FunctionSummary.cpp 1000 B

123456789101112131415161718192021222324252627282930
  1. //===- FunctionSummary.cpp - Stores summaries of functions. ---------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines a summary of a function gathered/used by static analysis.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h"
  13. using namespace clang;
  14. using namespace ento;
  15. unsigned FunctionSummariesTy::getTotalNumBasicBlocks() {
  16. unsigned Total = 0;
  17. for (const auto &I : Map)
  18. Total += I.second.TotalBasicBlocks;
  19. return Total;
  20. }
  21. unsigned FunctionSummariesTy::getTotalNumVisitedBasicBlocks() {
  22. unsigned Total = 0;
  23. for (const auto &I : Map)
  24. Total += I.second.VisitedBasicBlocks.count();
  25. return Total;
  26. }