aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Checkers/CheckerBase.td
blob: 453e189fccb01b4a4e51166ddf535028a4bb7bae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//===--- CheckerBase.td - Checker TableGen classes ------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the TableGen core definitions for checkers
//
//===----------------------------------------------------------------------===//

/// Describes a package. Every checker is a part of a package, for example,
/// 'NullDereference' is part of the 'core' package, hence it's full name is
/// 'core.NullDereference'.
/// Example:
///   def Core : Package<"core">;
class Package<string name> {
  string       PackageName = name;
  Package ParentPackage;
}

/// Describes a 'super' package that holds another package inside it. This is
/// used to nest packages in one another. One may, for example, create the
/// 'builtin' package inside 'core', thus creating the package 'core.builtin'.
/// Example:
///   def CoreBuiltin : Package<"builtin">, ParentPackage<Core>;
class ParentPackage<Package P> { Package ParentPackage = P; }

/// A description. May be displayed to the user when clang is invoked with
/// a '-help'-like command line option.
class HelpText<string text> { string HelpText = text; }

/// Describes what kind of documentation exists for the checker.
class DocumentationEnum<bits<2> val> {
  bits<2> Documentation = val;
}
def NotDocumented : DocumentationEnum<0>;
def HasDocumentation : DocumentationEnum<1>;
def HasAlphaDocumentation : DocumentationEnum<2>;

class Documentation<DocumentationEnum val> {
  bits<2> Documentation = val.Documentation;
}

/// Describes a checker. Every builtin checker has to be registered with the use
/// of this class (out-of-trunk checkers loaded from plugins obviously don't).
/// Note that a checker has a name (e.g.: 'NullDereference'), and a fullname,
/// that is autogenerated with the help of the ParentPackage field, that also
/// includes package names (e.g.: 'core.NullDereference').
class Checker<string name = ""> {
  string      CheckerName = name;
  string      HelpText;
  bits<2>     Documentation;
  Package ParentPackage;
}