14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H 15 #define LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H 18 #include "llvm/ADT/IntrusiveRefCntPtr.h" 19 #include "llvm/ADT/Optional.h" 20 #include "llvm/ADT/StringMap.h" 21 #include "llvm/ADT/StringRef.h" 22 #include "llvm/ADT/StringSwitch.h" 37 #define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE) NAME, 38 #include "clang/StaticAnalyzer/Core/Analyses.def" 44 #define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) NAME##Model, 45 #include "clang/StaticAnalyzer/Core/Analyses.def" 51 #define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) NAME##Model, 52 #include "clang/StaticAnalyzer/Core/Analyses.def" 59 #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) PD_##NAME, 60 #include "clang/StaticAnalyzer/Core/Analyses.def" 67 #define ANALYSIS_PURGE(NAME, CMDFLAG, DESC) NAME, 68 #include "clang/StaticAnalyzer/Core/Analyses.def" 74 #define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC) NAME, 75 #include "clang/StaticAnalyzer/Core/Analyses.def" 168 static std::vector<StringRef>
169 getRegisteredCheckers(
bool IncludeExperimental =
false);
173 static std::vector<StringRef>
174 getRegisteredPackages(
bool IncludeExperimental =
false);
193 static void printFormattedEntry(
194 llvm::raw_ostream &Out,
195 std::pair<StringRef, StringRef> EntryDescPair,
196 size_t EntryWidth,
size_t InitialPad,
size_t MinLineWidth = 0);
262 unsigned InlineMaxStackDepth = 5;
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) \ 275 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.def" 276 #undef ANALYZER_OPTION 277 #undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE 281 std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = {
282 #define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \ 283 SHALLOW_VAL, DEEP_VAL) \ 284 ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL) 286 #define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \ 287 llvm::StringLiteral(CMDFLAG), 289 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.def" 290 #undef ANALYZER_OPTION 291 #undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE 296 assert(std::is_sorted(AnalyzerConfigCmdFlags.begin(),
297 AnalyzerConfigCmdFlags.end()));
299 return !std::binary_search(AnalyzerConfigCmdFlags.begin(),
300 AnalyzerConfigCmdFlags.end(), Name);
304 : DisableAllCheckers(
false), ShowCheckerHelp(
false),
305 ShowCheckerHelpAlpha(
false), ShowCheckerHelpDeveloper(
false),
306 ShowCheckerOptionList(
false), ShowCheckerOptionAlphaList(
false),
307 ShowCheckerOptionDeveloperList(
false), ShowEnabledCheckerList(
false),
308 ShowConfigOptionsList(
false), AnalyzeAll(
false),
309 AnalyzerDisplayProgress(
false), AnalyzeNestedBlocks(
false),
310 eagerlyAssumeBinOpBifurcation(
false), TrimGraph(
false),
311 visualizeExplodedGraphWithGraphViz(
false), UnoptimizedCFG(
false),
313 llvm::sort(AnalyzerConfigCmdFlags);
331 bool getCheckerBooleanOption(StringRef CheckerName, StringRef OptionName,
332 bool SearchInParents =
false)
const;
335 bool SearchInParents =
false)
const;
351 int getCheckerIntegerOption(StringRef CheckerName, StringRef OptionName,
352 bool SearchInParents =
false)
const;
355 bool SearchInParents =
false)
const;
371 StringRef getCheckerStringOption(StringRef CheckerName, StringRef OptionName,
372 bool SearchInParents =
false)
const;
375 StringRef OptionName,
376 bool SearchInParents =
false)
const;
408 auto K = llvm::StringSwitch<llvm::Optional<UserModeKind>>(UserMode)
412 assert(K.hasValue() &&
"User mode is invalid.");
416 inline std::vector<StringRef>
418 static constexpr llvm::StringLiteral StaticAnalyzerCheckerNames[] = {
420 #define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) \ 421 llvm::StringLiteral(FULLNAME), 422 #include "clang/StaticAnalyzer/Checkers/Checkers.inc" 426 std::vector<StringRef> Checkers;
427 for (StringRef CheckerName : StaticAnalyzerCheckerNames) {
428 if (!CheckerName.startswith(
"debug.") &&
429 (IncludeExperimental || !CheckerName.startswith(
"alpha.")))
430 Checkers.push_back(CheckerName);
435 inline std::vector<StringRef>
437 static constexpr llvm::StringLiteral StaticAnalyzerPackageNames[] = {
439 #define PACKAGE(FULLNAME) llvm::StringLiteral(FULLNAME), 440 #include "clang/StaticAnalyzer/Checkers/Checkers.inc" 444 std::vector<StringRef> Packages;
445 for (StringRef PackageName : StaticAnalyzerPackageNames) {
446 if (PackageName !=
"debug" &&
447 (IncludeExperimental || PackageName !=
"alpha"))
448 Packages.push_back(PackageName);
455 #endif // LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H
Inline C functions and blocks when their definitions are available.
IPAKind
Describes the different modes of inter-procedural analysis.
unsigned ShowCheckerHelpDeveloper
unsigned visualizeExplodedGraphWithGraphViz
static std::vector< StringRef > getRegisteredCheckers(bool IncludeExperimental=false)
Retrieves the list of checkers generated from Checkers.td.
Perform only intra-procedural analysis.
UserModeKind getUserMode() const
Retrieves and sets the UserMode.
A dummy mode in which no C++ inlining is enabled.
Inline callees(C, C++, ObjC) when their definitions are available.
std::string DumpExplodedGraphTo
File path to which the exploded graph should be dumped.
unsigned eagerlyAssumeBinOpBifurcation
unsigned ShowCheckerHelpAlpha
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
unsigned ShowCheckerOptionList
std::string FullCompilerInvocation
Store full compiler invocation for reproducible instructions in the generated report.
AnalysisStores
AnalysisStores - Set of available analysis store models.
unsigned DisableAllCheckers
Disable all analyzer checkers.
static std::vector< StringRef > getRegisteredPackages(bool IncludeExperimental=false)
Retrieves the list of packages generated from Checkers.td.
unsigned ShowEnabledCheckerList
std::vector< std::string > SilencedCheckersAndPackages
Vector of checker/package names which will not emit warnings.
Refers to regular member function and operator calls.
unsigned ShowConfigOptionsList
AnalysisInliningMode
AnalysisInlineFunctionSelection - Set of inlining function selection heuristics.
Refers to constructors (implicit or explicit).
unsigned AnalyzerWerror
Emit analyzer warnings as errors.
Enable inlining of dynamically dispatched methods.
UserModeKind
Describes the kinds for high-level analyzer mode.
AnalysisConstraints
AnalysisConstraints - Set of available constraint models.
llvm::StringMap< std::string > ConfigTable
ConfigTable Config
A key-value table of use-specified configuration values.
unsigned ShowCheckerOptionDeveloperList
std::vector< std::pair< std::string, bool > > CheckersAndPackages
Pairs of checker/package name and enable/disable.
Refers to destructors (implicit or explicit).
bool isUnknownAnalyzerConfig(StringRef Name) const
unsigned maxBlockVisitOnPath
The maximum number of times the analyzer visits a block.
Dataflow Directional Tag Classes.
Perform shallow but fast analyzes.
std::string AnalyzeSpecificFunction
AnalysisPurgeMode
AnalysisPurgeModes - Set of available strategies for dead symbol removal.
Stores options for the analyzer from the command line.
unsigned AnalyzerDisplayProgress
unsigned ShowCheckerOptionAlphaList
unsigned AnalyzeNestedBlocks
unsigned NoRetryExhausted
Do not re-analyze paths leading to exhausted nodes with a different strategy.
Analyses
Analysis - Set of available source code analyses.
CXXInlineableMemberKind
Describes the different kinds of C++ member functions which can be considered for inlining by the ana...
unsigned ShouldEmitErrorsOnInvalidConfigValue
Enable inlining of dynamically dispatched methods, bifurcate paths when exact type info is unavailabl...
AnalysisDiagClients
AnalysisDiagClients - Set of available diagnostic clients for rendering analysis results.