1//===-- Analyses.def - Metadata about Static Analyses -----------*- C++ -*-===//
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 the set of static analyses used by AnalysisConsumer.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef ANALYSIS_CONSTRAINTS
14#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN)
15#endif
16
17ANALYSIS_CONSTRAINTS(RangeConstraints, "range",
18                     "Use constraint tracking of concrete value ranges",
19                     CreateRangeConstraintManager)
20
21ANALYSIS_CONSTRAINTS(Z3Constraints, "z3", "Use Z3 contraint solver",
22                     CreateZ3ConstraintManager)
23
24#ifndef ANALYSIS_DIAGNOSTICS
25#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN)
26#endif
27
28ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML",
29                     createHTMLDiagnosticConsumer)
30
31ANALYSIS_DIAGNOSTICS(
32    HTML_SINGLE_FILE, "html-single-file",
33    "Output analysis results using HTML (not allowing for multi-file bugs)",
34    createHTMLSingleFileDiagnosticConsumer)
35
36ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists",
37                     createPlistDiagnosticConsumer)
38
39ANALYSIS_DIAGNOSTICS(
40    PLIST_MULTI_FILE, "plist-multi-file",
41    "Output analysis results using Plists (allowing for multi-file bugs)",
42    createPlistMultiFileDiagnosticConsumer)
43
44ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html",
45                     "Output analysis results using HTML wrapped with Plists",
46                     createPlistHTMLDiagnosticConsumer)
47
48ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results using SARIF",
49                     createSarifDiagnosticConsumer)
50
51ANALYSIS_DIAGNOSTICS(SARIF_HTML, "sarif-html",
52                     "Output analysis results using both SARIF and HTML "
53                     "output files",
54                     createSarifHTMLDiagnosticConsumer)
55
56ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results to stderr",
57                     createTextPathDiagnosticConsumer)
58
59ANALYSIS_DIAGNOSTICS(TEXT_MINIMAL, "text-minimal",
60                     "Emits minimal diagnostics to stderr, stating only the "
61                     "warning message and the associated notes. Usually "
62                     "used in addition to other analysis types",
63                     createTextMinimalPathDiagnosticConsumer)
64
65#ifndef ANALYSIS_PURGE
66#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC)
67#endif
68
69ANALYSIS_PURGE(
70    PurgeStmt, "statement",
71    "Purge symbols, bindings, and constraints before every statement")
72
73ANALYSIS_PURGE(
74    PurgeBlock, "block",
75    "Purge symbols, bindings, and constraints before every basic block")
76
77ANALYSIS_PURGE(PurgeNone, "none",
78               "Do not purge symbols, bindings, or constraints")
79
80#ifndef ANALYSIS_INLINING_MODE
81#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC)
82#endif
83
84ANALYSIS_INLINING_MODE(All, "all", "Analyze all functions as top level")
85
86ANALYSIS_INLINING_MODE(
87    NoRedundancy, "noredundancy",
88    "Do not analyze a function which has been previously inlined")
89
90#undef ANALYSIS_CONSTRAINTS
91#undef ANALYSIS_DIAGNOSTICS
92#undef ANALYSIS_PURGE
93#undef ANALYSIS_INLINING_MODE
94#undef ANALYSIS_IPA
95