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);
251#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
252 SHALLOW_VAL, DEEP_VAL) \
253 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
255#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
258#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
259#undef ANALYZER_OPTION
260#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
263 static std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = []() {
265 std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = {
266#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
267 SHALLOW_VAL, DEEP_VAL) \
268 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
270#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
271 llvm::StringLiteral(CMDFLAG),
273#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
274#undef ANALYZER_OPTION
275#undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
278 llvm::sort(AnalyzerConfigCmdFlags);
279 return AnalyzerConfigCmdFlags;
282 return !std::binary_search(AnalyzerConfigCmdFlags.begin(),
283 AnalyzerConfigCmdFlags.end(), Name);
314 bool SearchInParents =
false)
const;
317 bool SearchInParents =
false)
const;
334 bool SearchInParents =
false)
const;
337 bool SearchInParents =
false)
const;
354 bool SearchInParents =
false)
const;
357 StringRef OptionName,
358 bool SearchInParents =
false)
const;
376 ShouldDisplayMacroExpansions,
377 ShouldSerializeStats,
382 ShouldWriteStableReportFilename || ShouldWriteVerboseReportFilename,
385 ShouldDisplayCheckerNameForText};
399inline std::vector<StringRef>
401 static constexpr llvm::StringLiteral StaticAnalyzerCheckerNames[] = {
403#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) \
404 llvm::StringLiteral(FULLNAME),
405#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
409 std::vector<StringRef> Checkers;
410 for (StringRef CheckerName : StaticAnalyzerCheckerNames) {
411 if (!CheckerName.starts_with(
"debug.") &&
412 (IncludeExperimental || !CheckerName.starts_with(
"alpha.")))
413 Checkers.push_back(CheckerName);
418inline std::vector<StringRef>
420 static constexpr llvm::StringLiteral StaticAnalyzerPackageNames[] = {
422#define PACKAGE(FULLNAME) llvm::StringLiteral(FULLNAME),
423#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
427 std::vector<StringRef> Packages;
428 for (StringRef PackageName : StaticAnalyzerPackageNames) {
429 if (PackageName !=
"debug" &&
430 (IncludeExperimental || PackageName !=
"alpha"))
431 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.
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.