clang 20.0.0git
|
Stores options for the analyzer from the command line. More...
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
Public Types | |
using | ConfigTable = llvm::StringMap< std::string > |
Public Member Functions | |
bool | isUnknownAnalyzerConfig (llvm::StringRef Name) |
AnalyzerOptions () | |
bool | getCheckerBooleanOption (StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const |
Interprets an option's string value as a boolean. | |
bool | getCheckerBooleanOption (const ento::CheckerBase *C, StringRef OptionName, bool SearchInParents=false) const |
int | getCheckerIntegerOption (StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const |
Interprets an option's string value as an integer value. | |
int | getCheckerIntegerOption (const ento::CheckerBase *C, StringRef OptionName, bool SearchInParents=false) const |
StringRef | getCheckerStringOption (StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const |
Query an option's string value. | |
StringRef | getCheckerStringOption (const ento::CheckerBase *C, StringRef OptionName, bool SearchInParents=false) const |
ExplorationStrategyKind | getExplorationStrategy () const |
CTUPhase1InliningKind | getCTUPhase1Inlining () const |
IPAKind | getIPAMode () const |
Returns the inter-procedural analysis mode. | |
bool | mayInlineCXXMemberFunction (CXXInlineableMemberKind K) const |
Returns the option controlling which C++ member functions will be considered for inlining. | |
ento::PathDiagnosticConsumerOptions | getDiagOpts () const |
Static Public Member Functions | |
static std::vector< StringRef > | getRegisteredCheckers (bool IncludeExperimental=false) |
Retrieves the list of checkers generated from Checkers.td. | |
static std::vector< StringRef > | getRegisteredPackages (bool IncludeExperimental=false) |
Retrieves the list of packages generated from Checkers.td. | |
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. | |
Public Attributes | |
std::vector< std::pair< std::string, bool > > | CheckersAndPackages |
Pairs of checker/package name and enable/disable. | |
std::vector< std::string > | SilencedCheckersAndPackages |
Vector of checker/package names which will not emit warnings. | |
ConfigTable | Config |
A key-value table of use-specified configuration values. | |
AnalysisConstraints | AnalysisConstraintsOpt = RangeConstraintsModel |
AnalysisDiagClients | AnalysisDiagOpt = PD_HTML |
AnalysisPurgeMode | AnalysisPurgeOpt = PurgeStmt |
std::string | AnalyzeSpecificFunction |
std::string | DumpExplodedGraphTo |
File path to which the exploded graph should be dumped. | |
std::string | FullCompilerInvocation |
Store full compiler invocation for reproducible instructions in the generated report. | |
unsigned | maxBlockVisitOnPath |
The maximum number of times the analyzer visits a block. | |
unsigned | DisableAllCheckers: 1 |
Disable all analyzer checkers. | |
unsigned | ShowCheckerHelp: 1 |
unsigned | ShowCheckerHelpAlpha: 1 |
unsigned | ShowCheckerHelpDeveloper: 1 |
unsigned | ShowCheckerOptionList: 1 |
unsigned | ShowCheckerOptionAlphaList: 1 |
unsigned | ShowCheckerOptionDeveloperList: 1 |
unsigned | ShowEnabledCheckerList: 1 |
unsigned | ShowConfigOptionsList: 1 |
unsigned | ShouldEmitErrorsOnInvalidConfigValue: 1 |
unsigned | AnalyzeAll: 1 |
unsigned | AnalyzerDisplayProgress: 1 |
unsigned | AnalyzerNoteAnalysisEntryPoints: 1 |
unsigned | TrimGraph: 1 |
unsigned | visualizeExplodedGraphWithGraphViz: 1 |
unsigned | UnoptimizedCFG: 1 |
unsigned | PrintStats: 1 |
unsigned | NoRetryExhausted: 1 |
Do not re-analyze paths leading to exhausted nodes with a different strategy. | |
bool | AnalyzerWerror: 1 |
Emit analyzer warnings as errors. | |
unsigned | InlineMaxStackDepth |
The inlining stack depth limit. | |
AnalysisInliningMode | InliningMode = NoRedundancy |
The mode of function selection used during inlining. | |
Stores options for the analyzer from the command line.
Some options are frontend flags (e.g.: -analyzer-output), but some are analyzer configuration options, which are preceded by -analyzer-config (e.g.: -analyzer-config notes-as-events=true).
If you'd like to add a new frontend flag, add it to include/clang/Driver/CC1Options.td, add a new field to store the value of that flag in this class, and initialize it in lib/Frontend/CompilerInvocation.cpp.
If you'd like to add a new non-checker configuration, register it in include/clang/StaticAnalyzer/Core/AnalyzerOptions.def, and refer to the top of the file for documentation.
If you'd like to add a new checker option, call getChecker*Option() whenever.
Some of the options are controlled by raw frontend flags for no good reason, and should be eventually converted into -analyzer-config flags. New analyzer options should not be implemented as frontend flags. Frontend flags still make sense for things that do not affect the actual analysis.
Definition at line 149 of file AnalyzerOptions.h.
using clang::AnalyzerOptions::ConfigTable = llvm::StringMap<std::string> |
Definition at line 151 of file AnalyzerOptions.h.
|
inline |
Definition at line 286 of file AnalyzerOptions.h.
bool AnalyzerOptions::getCheckerBooleanOption | ( | const ento::CheckerBase * | C, |
StringRef | OptionName, | ||
bool | SearchInParents = false |
||
) | const |
Definition at line 178 of file AnalyzerOptions.cpp.
References clang::C, and getCheckerBooleanOption().
bool AnalyzerOptions::getCheckerBooleanOption | ( | StringRef | CheckerName, |
StringRef | OptionName, | ||
bool | SearchInParents = false |
||
) | const |
Interprets an option's string value as a boolean.
The "true" string is interpreted as true and the "false" string is interpreted as false.
If an option value is not provided, returns the given DefaultVal
.
[in] | CheckerName | The full name of the checker. One may retrieve this from the checker object's field Name , or through CheckerManager::getCurrentCheckerName within the checker's registry function. Checker options are retrieved in the following format: `-analyzer-config CheckerName:OptionName=Value. |
[in] | OptionName | Name for option to retrieve. |
[in] | SearchInParents | If set to true and the searched option was not specified for the given checker the options for the parent packages will be searched as well. The inner packages take precedence over the outer ones. |
Definition at line 161 of file AnalyzerOptions.cpp.
References getCheckerStringOption().
Referenced by getCheckerBooleanOption().
int AnalyzerOptions::getCheckerIntegerOption | ( | const ento::CheckerBase * | C, |
StringRef | OptionName, | ||
bool | SearchInParents = false |
||
) | const |
Definition at line 199 of file AnalyzerOptions.cpp.
References clang::C, and getCheckerIntegerOption().
int AnalyzerOptions::getCheckerIntegerOption | ( | StringRef | CheckerName, |
StringRef | OptionName, | ||
bool | SearchInParents = false |
||
) | const |
Interprets an option's string value as an integer value.
If an option value is not provided, returns the given DefaultVal
.
[in] | CheckerName | The full name of the checker. One may retrieve this from the checker object's field Name , or through CheckerManager::getCurrentCheckerName within the checker's registry function. Checker options are retrieved in the following format: `-analyzer-config CheckerName:OptionName=Value. |
[in] | OptionName | Name for option to retrieve. |
[in] | SearchInParents | If set to true and the searched option was not specified for the given checker the options for the parent packages will be searched as well. The inner packages take precedence over the outer ones. |
Definition at line 185 of file AnalyzerOptions.cpp.
References getCheckerStringOption().
Referenced by getCheckerIntegerOption().
StringRef AnalyzerOptions::getCheckerStringOption | ( | const ento::CheckerBase * | C, |
StringRef | OptionName, | ||
bool | SearchInParents = false |
||
) | const |
Definition at line 154 of file AnalyzerOptions.cpp.
References clang::C, and getCheckerStringOption().
StringRef AnalyzerOptions::getCheckerStringOption | ( | StringRef | CheckerName, |
StringRef | OptionName, | ||
bool | SearchInParents = false |
||
) | const |
Query an option's string value.
If an option value is not provided, returns the given DefaultVal
.
[in] | CheckerName | The full name of the checker. One may retrieve this from the checker object's field Name , or through CheckerManager::getCurrentCheckerName within the checker's registry function. Checker options are retrieved in the following format: `-analyzer-config CheckerName:OptionName=Value. |
[in] | OptionName | Name for option to retrieve. |
[in] | SearchInParents | If set to true and the searched option was not specified for the given checker the options for the parent packages will be searched as well. The inner packages take precedence over the outer ones. |
Definition at line 127 of file AnalyzerOptions.cpp.
Referenced by getCheckerBooleanOption(), getCheckerIntegerOption(), and getCheckerStringOption().
CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining | ( | ) | const |
Definition at line 84 of file AnalyzerOptions.cpp.
References clang::All, clang::None, and clang::Small.
Referenced by REGISTER_MAP_WITH_PROGRAMSTATE().
|
inline |
Definition at line 374 of file AnalyzerOptions.h.
References AnalyzerWerror, and FullCompilerInvocation.
ExplorationStrategyKind AnalyzerOptions::getExplorationStrategy | ( | ) | const |
Definition at line 66 of file AnalyzerOptions.cpp.
References clang::BFS, clang::BFSBlockDFSContents, clang::DFS, clang::UnexploredFirst, clang::UnexploredFirstLocationQueue, and clang::UnexploredFirstQueue.
Referenced by generateWorkList().
IPAKind AnalyzerOptions::getIPAMode | ( | ) | const |
Returns the inter-procedural analysis mode.
Definition at line 95 of file AnalyzerOptions.cpp.
References clang::IPAK_BasicInlining, clang::IPAK_DynamicDispatch, clang::IPAK_DynamicDispatchBifurcate, clang::IPAK_Inlining, and clang::IPAK_None.
Referenced by mayInlineCXXMemberFunction(), and clang::ento::AnalysisManager::shouldInlineCall().
|
inlinestatic |
Retrieves the list of checkers generated from Checkers.td.
This doesn't contain statically linked but non-generated checkers and plugin checkers!
Definition at line 400 of file AnalyzerOptions.h.
Referenced by parseAnalyzerConfigs().
|
inlinestatic |
Retrieves the list of packages generated from Checkers.td.
This doesn't contain statically linked but non-generated packages and plugin packages!
Definition at line 419 of file AnalyzerOptions.h.
Referenced by parseAnalyzerConfigs().
|
inline |
Definition at line 262 of file AnalyzerOptions.h.
Referenced by ParseAnalyzerArgs().
bool AnalyzerOptions::mayInlineCXXMemberFunction | ( | CXXInlineableMemberKind | K | ) | const |
Returns the option controlling which C++ member functions will be considered for inlining.
This is controlled by the 'c++-inlining' config option.
Definition at line 109 of file AnalyzerOptions.cpp.
References clang::CIMK_Constructors, clang::CIMK_Destructors, clang::CIMK_MemberFunctions, clang::CIMK_None, getIPAMode(), and clang::IPAK_Inlining.
|
static |
Convenience function for printing options or checkers and their description in a formatted manner.
If MinLineWidth
is set to 0, no line breaks are introduced for the description.
Format, depending whether the option name's length is less than EntryWidth:
<padding>EntryName<padding>Description <------—padding------—>Description <------—padding------—>Description
<padding>VeryVeryLongEntryName <------—padding------—>Description <------—padding------—>Description ^~~~~~~~~InitialPad ^~~~~~~~~~~~~~~~~~EntryWidth ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~MinLineWidth
Definition at line 34 of file AnalyzerOptions.cpp.
References clang::C.
Referenced by clang::ento::CheckerRegistryData::printCheckerOptionList(), and clang::ento::CheckerRegistryData::printCheckerWithDescList().
AnalysisConstraints clang::AnalyzerOptions::AnalysisConstraintsOpt = RangeConstraintsModel |
Definition at line 194 of file AnalyzerOptions.h.
Referenced by GenerateAnalyzerArgs(), and ParseAnalyzerArgs().
AnalysisDiagClients clang::AnalyzerOptions::AnalysisDiagOpt = PD_HTML |
Definition at line 195 of file AnalyzerOptions.h.
Referenced by constructDebugPieceForTrackedCondition(), GenerateAnalyzerArgs(), and ParseAnalyzerArgs().
AnalysisPurgeMode clang::AnalyzerOptions::AnalysisPurgeOpt = PurgeStmt |
Definition at line 196 of file AnalyzerOptions.h.
Referenced by GenerateAnalyzerArgs(), ParseAnalyzerArgs(), clang::ento::ExprEngine::processCallExit(), and shouldRemoveDeadBindings().
unsigned clang::AnalyzerOptions::AnalyzeAll |
Definition at line 228 of file AnalyzerOptions.h.
unsigned clang::AnalyzerOptions::AnalyzerDisplayProgress |
Definition at line 229 of file AnalyzerOptions.h.
Referenced by reportAnalyzerFunctionMisuse().
unsigned clang::AnalyzerOptions::AnalyzerNoteAnalysisEntryPoints |
Definition at line 230 of file AnalyzerOptions.h.
bool clang::AnalyzerOptions::AnalyzerWerror |
Emit analyzer warnings as errors.
Definition at line 242 of file AnalyzerOptions.h.
Referenced by getDiagOpts().
std::string clang::AnalyzerOptions::AnalyzeSpecificFunction |
Definition at line 198 of file AnalyzerOptions.h.
Referenced by reportAnalyzerFunctionMisuse().
std::vector<std::pair<std::string, bool> > clang::AnalyzerOptions::CheckersAndPackages |
Pairs of checker/package name and enable/disable.
Definition at line 186 of file AnalyzerOptions.h.
Referenced by clang::ento::CheckerRegistry::CheckerRegistry(), GenerateAnalyzerArgs(), and ParseAnalyzerArgs().
ConfigTable clang::AnalyzerOptions::Config |
A key-value table of use-specified configuration values.
Definition at line 193 of file AnalyzerOptions.h.
Referenced by clang::ento::CreateAnalysisConsumer(), GenerateAnalyzerArgs(), getCheckerStringOption(), insertAndValidate(), ParseAnalyzerArgs(), and clang::ento::CheckerRegistry::validateCheckerOptions().
unsigned clang::AnalyzerOptions::DisableAllCheckers |
Disable all analyzer checkers.
This flag allows one to disable analyzer checkers on the code processed by the given analysis consumer. Note, the code will get parsed and the command-line options will get checked.
Definition at line 215 of file AnalyzerOptions.h.
std::string clang::AnalyzerOptions::DumpExplodedGraphTo |
File path to which the exploded graph should be dumped.
Definition at line 201 of file AnalyzerOptions.h.
std::string clang::AnalyzerOptions::FullCompilerInvocation |
Store full compiler invocation for reproducible instructions in the generated report.
Definition at line 205 of file AnalyzerOptions.h.
Referenced by getDiagOpts(), and ParseAnalyzerArgs().
unsigned clang::AnalyzerOptions::InlineMaxStackDepth |
The inlining stack depth limit.
Definition at line 245 of file AnalyzerOptions.h.
AnalysisInliningMode clang::AnalyzerOptions::InliningMode = NoRedundancy |
The mode of function selection used during inlining.
Definition at line 248 of file AnalyzerOptions.h.
Referenced by GenerateAnalyzerArgs(), and ParseAnalyzerArgs().
unsigned clang::AnalyzerOptions::maxBlockVisitOnPath |
The maximum number of times the analyzer visits a block.
Definition at line 208 of file AnalyzerOptions.h.
Referenced by clang::ento::ExprEngine::processCFGBlockEntrance().
unsigned clang::AnalyzerOptions::NoRetryExhausted |
Do not re-analyze paths leading to exhausted nodes with a different strategy.
We get better code coverage when retry is enabled.
Definition at line 239 of file AnalyzerOptions.h.
Referenced by clang::ento::ExprEngine::processCFGBlockEntrance().
unsigned clang::AnalyzerOptions::PrintStats |
Definition at line 235 of file AnalyzerOptions.h.
unsigned clang::AnalyzerOptions::ShouldEmitErrorsOnInvalidConfigValue |
Definition at line 227 of file AnalyzerOptions.h.
Referenced by insertAndValidate(), isOptionContainedIn(), and ParseAnalyzerArgs().
unsigned clang::AnalyzerOptions::ShowCheckerHelp |
Definition at line 217 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation(), and clang::ento::CheckerRegistryData::printCheckerWithDescList().
unsigned clang::AnalyzerOptions::ShowCheckerHelpAlpha |
Definition at line 218 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation(), and clang::ento::CheckerRegistryData::printCheckerWithDescList().
unsigned clang::AnalyzerOptions::ShowCheckerHelpDeveloper |
Definition at line 219 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation(), and clang::ento::CheckerRegistryData::printCheckerWithDescList().
unsigned clang::AnalyzerOptions::ShowCheckerOptionAlphaList |
Definition at line 222 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation(), and clang::ento::CheckerRegistryData::printCheckerOptionList().
unsigned clang::AnalyzerOptions::ShowCheckerOptionDeveloperList |
Definition at line 223 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation(), and clang::ento::CheckerRegistryData::printCheckerOptionList().
unsigned clang::AnalyzerOptions::ShowCheckerOptionList |
Definition at line 221 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation(), and clang::ento::CheckerRegistryData::printCheckerOptionList().
unsigned clang::AnalyzerOptions::ShowConfigOptionsList |
Definition at line 226 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation().
unsigned clang::AnalyzerOptions::ShowEnabledCheckerList |
Definition at line 225 of file AnalyzerOptions.h.
Referenced by clang::ExecuteCompilerInvocation().
std::vector<std::string> clang::AnalyzerOptions::SilencedCheckersAndPackages |
Vector of checker/package names which will not emit warnings.
Definition at line 189 of file AnalyzerOptions.h.
Referenced by parseAnalyzerConfigs().
unsigned clang::AnalyzerOptions::TrimGraph |
Definition at line 232 of file AnalyzerOptions.h.
unsigned clang::AnalyzerOptions::UnoptimizedCFG |
Definition at line 234 of file AnalyzerOptions.h.
unsigned clang::AnalyzerOptions::visualizeExplodedGraphWithGraphViz |
Definition at line 233 of file AnalyzerOptions.h.
Referenced by clang::ento::AnalysisManager::shouldVisualize().