xref: /llvm-project/clang/lib/StaticAnalyzer/Core/Checker.cpp (revision fa0734ec4f15f8a83053812e17e210f5790c042a)
1 //== Checker.h - Abstract interface for checkers -----------------*- 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 Checker and CheckerVisitor, classes used for creating
11 //  domain-specific checks.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "clang/StaticAnalyzer/PathSensitive/Checker.h"
16 using namespace clang;
17 using namespace ento;
18 
19 Checker::~Checker() {}
20 
21 CheckerContext::~CheckerContext() {
22   // Do we need to autotransition?  'Dst' can get populated in a variety of
23   // ways, including 'addTransition()' adding the predecessor node to Dst
24   // without actually generated a new node.  We also shouldn't autotransition
25   // if we are building sinks or we generated a node and decided to not
26   // add it as a transition.
27   if (Dst.size() == size && !B.BuildSinks && !B.hasGeneratedNode) {
28     if (ST && ST != B.GetState(Pred)) {
29       static int autoTransitionTag = 0;
30       addTransition(ST, &autoTransitionTag);
31     }
32     else
33       Dst.Add(Pred);
34   }
35 }
36