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"
22#include "llvm/Support/Compiler.h"
37#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) NAME##Model,
38#include "clang/StaticAnalyzer/Core/Analyses.def"
45#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) PD_##NAME,
46#include "clang/StaticAnalyzer/Core/Analyses.def"
53#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC) NAME,
54#include "clang/StaticAnalyzer/Core/Analyses.def"
60#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC) NAME,
61#include "clang/StaticAnalyzer/Core/Analyses.def"
132 assert(
Value > 0 &&
"only positive values are accepted");
141 static constexpr std::optional<PositiveAnalyzerOption>
create(
unsigned Val) {
146 static std::optional<PositiveAnalyzerOption>
create(StringRef Str) {
148 if (Str.getAsInteger(0, Parsed))
186 static std::vector<StringRef>
191 static std::vector<StringRef>
212 std::pair<StringRef, StringRef> EntryDescPair,
213 size_t InitialPad,
size_t EntryWidth,
214 size_t MinLineWidth = 0);
273 LLVM_PREFERRED_TYPE(
bool)
283#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
284 SHALLOW_VAL, DEEP_VAL) \
285 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
287#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
290#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
291#undef ANALYZER_OPTION
292#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
295 static std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = []() {
297 std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = {
298#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
299 SHALLOW_VAL, DEEP_VAL) \
300 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
302#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
303 llvm::StringLiteral(CMDFLAG),
305#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
306#undef ANALYZER_OPTION
307#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
310 llvm::sort(AnalyzerConfigCmdFlags);
311 return AnalyzerConfigCmdFlags;
314 return !llvm::binary_search(AnalyzerConfigCmdFlags, Name);
345 bool SearchInParents =
false)
const;
348 bool SearchInParents =
false)
const;
365 bool SearchInParents =
false)
const;
368 bool SearchInParents =
false)
const;
385 bool SearchInParents =
false)
const;
388 StringRef OptionName,
389 bool SearchInParents =
false)
const;
407 ShouldDisplayMacroExpansions,
408 ShouldSerializeStats,
413 ShouldWriteStableReportFilename || ShouldWriteVerboseReportFilename,
416 ShouldDisplayCheckerNameForText};
428inline std::vector<StringRef>
430 static constexpr llvm::StringLiteral StaticAnalyzerCheckerNames[] = {
432#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) \
433 llvm::StringLiteral(FULLNAME),
434#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
438 std::vector<StringRef> Checkers;
439 for (StringRef CheckerName : StaticAnalyzerCheckerNames) {
440 if (!CheckerName.starts_with(
"debug.") &&
441 (IncludeExperimental || !CheckerName.starts_with(
"alpha.")))
442 Checkers.push_back(CheckerName);
447inline std::vector<StringRef>
449 static constexpr llvm::StringLiteral StaticAnalyzerPackageNames[] = {
451#define PACKAGE(FULLNAME) llvm::StringLiteral(FULLNAME),
452#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
456 std::vector<StringRef> Packages;
457 for (StringRef PackageName : StaticAnalyzerPackageNames) {
458 if (PackageName !=
"debug" &&
459 (IncludeExperimental || PackageName !=
"alpha"))
460 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
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 AnalyzerWerror
Emit analyzer warnings as errors.
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)
constexpr PositiveAnalyzerOption(const PositiveAnalyzerOption &)=default
constexpr PositiveAnalyzerOption(unsigned Value)
constexpr PositiveAnalyzerOption()=default
static constexpr std::optional< PositiveAnalyzerOption > create(unsigned Val)
constexpr PositiveAnalyzerOption & operator=(const PositiveAnalyzerOption &Other)
The non-templated common ancestor of all the simple Checker<...> classes.
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
@ Other
Other implicit parameter.
These options tweak the behavior of path diangostic consumers.