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"
133 static std::optional<PositiveAnalyzerOption>
create(
unsigned Val) {
138 static std::optional<PositiveAnalyzerOption>
create(StringRef Str) {
140 if (Str.getAsInteger(0, Parsed))
180 static std::vector<StringRef>
185 static std::vector<StringRef>
206 std::pair<StringRef, StringRef> EntryDescPair,
207 size_t InitialPad,
size_t EntryWidth,
208 size_t MinLineWidth = 0);
276#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
277 SHALLOW_VAL, DEEP_VAL) \
278 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
280#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
283#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
284#undef ANALYZER_OPTION
285#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
288 static std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = []() {
290 std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = {
291#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
292 SHALLOW_VAL, DEEP_VAL) \
293 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
295#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
296 llvm::StringLiteral(CMDFLAG),
298#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
299#undef ANALYZER_OPTION
300#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
303 llvm::sort(AnalyzerConfigCmdFlags);
304 return AnalyzerConfigCmdFlags;
307 return !std::binary_search(AnalyzerConfigCmdFlags.begin(),
308 AnalyzerConfigCmdFlags.end(), Name);
339 bool SearchInParents =
false)
const;
342 bool SearchInParents =
false)
const;
359 bool SearchInParents =
false)
const;
362 bool SearchInParents =
false)
const;
379 bool SearchInParents =
false)
const;
382 StringRef OptionName,
383 bool SearchInParents =
false)
const;
401 ShouldDisplayMacroExpansions,
402 ShouldSerializeStats,
407 ShouldWriteStableReportFilename || ShouldWriteVerboseReportFilename,
410 ShouldDisplayCheckerNameForText};
424inline std::vector<StringRef>
426 static constexpr llvm::StringLiteral StaticAnalyzerCheckerNames[] = {
428#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) \
429 llvm::StringLiteral(FULLNAME),
430#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
434 std::vector<StringRef> Checkers;
435 for (StringRef CheckerName : StaticAnalyzerCheckerNames) {
436 if (!CheckerName.starts_with(
"debug.") &&
437 (IncludeExperimental || !CheckerName.starts_with(
"alpha.")))
438 Checkers.push_back(CheckerName);
443inline std::vector<StringRef>
445 static constexpr llvm::StringLiteral StaticAnalyzerPackageNames[] = {
447#define PACKAGE(FULLNAME) llvm::StringLiteral(FULLNAME),
448#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
452 std::vector<StringRef> Packages;
453 for (StringRef PackageName : StaticAnalyzerPackageNames) {
454 if (PackageName !=
"debug" &&
455 (IncludeExperimental || PackageName !=
"alpha"))
456 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.
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.
static std::optional< PositiveAnalyzerOption > create(StringRef Str)
PositiveAnalyzerOption & operator=(const PositiveAnalyzerOption &)=default
static std::optional< PositiveAnalyzerOption > create(unsigned Val)
PositiveAnalyzerOption()=default
PositiveAnalyzerOption(const PositiveAnalyzerOption &)=default
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.