CheckerContext.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. //== CheckerContext.cpp - Context info for path-sensitive checkers-----------=//
  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 CheckerContext that provides contextual info for
  11. // path-sensitive checkers.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
  15. using namespace clang;
  16. using namespace ento;
  17. CheckerContext::~CheckerContext() {
  18. // Do we need to autotransition? 'Dst' can get populated in a variety of
  19. // ways, including 'addTransition()' adding the predecessor node to Dst
  20. // without actually generated a new node. We also shouldn't autotransition
  21. // if we are building sinks or we generated a node and decided to not
  22. // add it as a transition.
  23. if (Dst.size() == size && !B.BuildSinks && !B.hasGeneratedNode) {
  24. if (ST && ST != Pred->getState()) {
  25. static SimpleProgramPointTag autoTransitionTag("CheckerContext : auto");
  26. addTransition(ST, &autoTransitionTag);
  27. }
  28. else
  29. Dst.Add(Pred);
  30. }
  31. }