14#ifndef LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H
15#define LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H
19#include "llvm/ADT/IntrusiveRefCntPtr.h"
20#include "llvm/ADT/StringMap.h"
21#include "llvm/ADT/StringRef.h"
36#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
37#include "clang/StaticAnalyzer/Core/Analyses.def"
44#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) PD_##NAME,
45#include "clang/StaticAnalyzer/Core/Analyses.def"
52#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC) NAME,
53#include "clang/StaticAnalyzer/Core/Analyses.def"
59#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC) NAME,
60#include "clang/StaticAnalyzer/Core/Analyses.def"
155 static std::vector<StringRef>
160 static std::vector<StringRef>
181 std::pair<StringRef, StringRef> EntryDescPair,
182 size_t InitialPad,
size_t EntryWidth,
183 size_t MinLineWidth = 0);
253#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
254 SHALLOW_VAL, DEEP_VAL) \
255 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
257#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
260#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
261#undef ANALYZER_OPTION
262#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
265 static std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = []() {
267 std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = {
268#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
269 SHALLOW_VAL, DEEP_VAL) \
270 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
272#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
273 llvm::StringLiteral(CMDFLAG),
275#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
276#undef ANALYZER_OPTION
277#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
280 llvm::sort(AnalyzerConfigCmdFlags);
281 return AnalyzerConfigCmdFlags;
284 return !std::binary_search(AnalyzerConfigCmdFlags.begin(),
285 AnalyzerConfigCmdFlags.end(), Name);
316 bool SearchInParents =
false)
const;
319 bool SearchInParents =
false)
const;
336 bool SearchInParents =
false)
const;
339 bool SearchInParents =
false)
const;
356 bool SearchInParents =
false)
const;
359 StringRef OptionName,
360 bool SearchInParents =
false)
const;
378 ShouldDisplayMacroExpansions,
379 ShouldSerializeStats,
384 ShouldWriteStableReportFilename || ShouldWriteVerboseReportFilename,
387 ShouldDisplayCheckerNameForText};
401inline std::vector<StringRef>
403 static constexpr llvm::StringLiteral StaticAnalyzerCheckerNames[] = {
405#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) \
406 llvm::StringLiteral(FULLNAME),
407#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
411 std::vector<StringRef> Checkers;
412 for (StringRef CheckerName : StaticAnalyzerCheckerNames) {
413 if (!CheckerName.starts_with(
"debug.") &&
414 (IncludeExperimental || !CheckerName.starts_with(
"alpha.")))
415 Checkers.push_back(CheckerName);
420inline std::vector<StringRef>
422 static constexpr llvm::StringLiteral StaticAnalyzerPackageNames[] = {
424#define PACKAGE(FULLNAME) llvm::StringLiteral(FULLNAME),
425#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
429 std::vector<StringRef> Packages;
430 for (StringRef PackageName : StaticAnalyzerPackageNames) {
431 if (PackageName !=
"debug" &&
432 (IncludeExperimental || PackageName !=
"alpha"))
433 Packages.push_back(PackageName);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Stores options for the analyzer from the command line.
static std::vector< StringRef > getRegisteredPackages(bool IncludeExperimental=false)
Retrieves the list of packages generated from Checkers.td.
unsigned eagerlyAssumeBinOpBifurcation
std::vector< std::pair< std::string, bool > > CheckersAndPackages
Pairs of checker/package name and enable/disable.
unsigned ShowCheckerOptionDeveloperList
unsigned DisableAllCheckers
Disable all analyzer checkers.
std::vector< std::string > SilencedCheckersAndPackages
Vector of checker/package names which will not emit warnings.
unsigned ShowEnabledCheckerList
unsigned ShowCheckerHelpAlpha
unsigned NoRetryExhausted
Do not re-analyze paths leading to exhausted nodes with a different strategy.
AnalysisDiagClients AnalysisDiagOpt
bool mayInlineCXXMemberFunction(CXXInlineableMemberKind K) const
Returns the option controlling which C++ member functions will be considered for inlining.
AnalysisConstraints AnalysisConstraintsOpt
unsigned ShowConfigOptionsList
unsigned visualizeExplodedGraphWithGraphViz
bool AnalyzerWerror
Emit analyzer warnings as errors.
unsigned AnalyzerNoteAnalysisEntryPoints
ConfigTable Config
A key-value table of use-specified configuration values.
bool getCheckerBooleanOption(StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const
Interprets an option's string value as a boolean.
unsigned maxBlockVisitOnPath
The maximum number of times the analyzer visits a block.
std::string AnalyzeSpecificFunction
unsigned ShowCheckerHelpDeveloper
IPAKind getIPAMode() const
Returns the inter-procedural analysis mode.
std::string DumpExplodedGraphTo
File path to which the exploded graph should be dumped.
unsigned ShouldEmitErrorsOnInvalidConfigValue
ento::PathDiagnosticConsumerOptions getDiagOpts() const
CTUPhase1InliningKind getCTUPhase1Inlining() const
AnalysisPurgeMode AnalysisPurgeOpt
unsigned ShowCheckerOptionList
bool isUnknownAnalyzerConfig(llvm::StringRef Name)
static std::vector< StringRef > getRegisteredCheckers(bool IncludeExperimental=false)
Retrieves the list of checkers generated from Checkers.td.
unsigned InlineMaxStackDepth
The inlining stack depth limit.
llvm::StringMap< std::string > ConfigTable
unsigned AnalyzerDisplayProgress
int getCheckerIntegerOption(StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const
Interprets an option's string value as an integer value.
static void printFormattedEntry(llvm::raw_ostream &Out, std::pair< StringRef, StringRef > EntryDescPair, size_t InitialPad, size_t EntryWidth, size_t MinLineWidth=0)
Convenience function for printing options or checkers and their description in a formatted manner.
ExplorationStrategyKind getExplorationStrategy() const
StringRef getCheckerStringOption(StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const
Query an option's string value.
unsigned ShowCheckerOptionAlphaList
std::string FullCompilerInvocation
Store full compiler invocation for reproducible instructions in the generated report.
AnalysisInliningMode InliningMode
The mode of function selection used during inlining.
The JSON file list parser is used to communicate input to InstallAPI.
UserModeKind
Describes the kinds for high-level analyzer mode.
@ UMK_Deep
Perform deep analyzes.
@ UMK_Shallow
Perform shallow but fast analyzes.
IPAKind
Describes the different modes of inter-procedural analysis.
@ IPAK_Inlining
Inline callees(C, C++, ObjC) when their definitions are available.
@ IPAK_BasicInlining
Inline C functions and blocks when their definitions are available.
@ IPAK_None
Perform only intra-procedural analysis.
@ IPAK_DynamicDispatch
Enable inlining of dynamically dispatched methods.
@ IPAK_DynamicDispatchBifurcate
Enable inlining of dynamically dispatched methods, bifurcate paths when exact type info is unavailabl...
AnalysisConstraints
AnalysisConstraints - Set of available constraint models.
CXXInlineableMemberKind
Describes the different kinds of C++ member functions which can be considered for inlining by the ana...
@ CIMK_Destructors
Refers to destructors (implicit or explicit).
@ CIMK_MemberFunctions
Refers to regular member function and operator calls.
@ CIMK_Constructors
Refers to constructors (implicit or explicit).
@ CIMK_None
A dummy mode in which no C++ inlining is enabled.
AnalysisPurgeMode
AnalysisPurgeModes - Set of available strategies for dead symbol removal.
AnalysisDiagClients
AnalysisDiagClients - Set of available diagnostic clients for rendering analysis results.
@ NUM_ANALYSIS_DIAG_CLIENTS
AnalysisInliningMode
AnalysisInlineFunctionSelection - Set of inlining function selection heuristics.
@ None
The alignment was not explicit in code.
@ UnexploredFirstLocationQueue
These options tweak the behavior of path diangostic consumers.