class AnalyzerOptions

Declaration

class AnalyzerOptions : public RefCountedBase { /* full declaration omitted */ };

Description

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.

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:151

Inherits from: RefCountedBase

Member Variables

public std::vector<std::pair<std::string, bool>> CheckersAndPackages
Pairs of checker/package name and enable/disable.
public std::vector<std::string> SilencedCheckersAndPackages
Vector of checker/package names which will not emit warnings.
public clang::AnalyzerOptions::ConfigTable Config
A key-value table of use-specified configuration values.
public clang::AnalysisConstraints AnalysisConstraintsOpt = RangeConstraintsModel
public clang::AnalysisDiagClients AnalysisDiagOpt = PD_HTML
public clang::AnalysisPurgeMode AnalysisPurgeOpt = PurgeStmt
public std::string AnalyzeSpecificFunction
public std::string DumpExplodedGraphTo
File path to which the exploded graph should be dumped.
public std::string FullCompilerInvocation
Store full compiler invocation for reproducible instructions in the generated report.
public unsigned int maxBlockVisitOnPath
The maximum number of times the analyzer visits a block.
public unsigned int DisableAllCheckers
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.
public unsigned int ShowCheckerHelp
public unsigned int ShowCheckerHelpAlpha
public unsigned int ShowCheckerHelpDeveloper
public unsigned int ShowCheckerOptionList
public unsigned int ShowCheckerOptionAlphaList
public unsigned int ShowCheckerOptionDeveloperList
public unsigned int ShowEnabledCheckerList
public unsigned int ShowConfigOptionsList
public unsigned int ShouldEmitErrorsOnInvalidConfigValue
public unsigned int AnalyzeAll
public unsigned int AnalyzerDisplayProgress
public unsigned int eagerlyAssumeBinOpBifurcation
public unsigned int TrimGraph
public unsigned int visualizeExplodedGraphWithGraphViz
public unsigned int UnoptimizedCFG
public unsigned int PrintStats
public unsigned int NoRetryExhausted
Do not re-analyze paths leading to exhausted nodes with a different strategy. We get better code coverage when retry is enabled.
public bool AnalyzerWerror
Emit analyzer warnings as errors.
public unsigned int InlineMaxStackDepth
The inlining stack depth limit.
public clang::AnalysisInliningMode InliningMode = NoRedundancy
The mode of function selection used during inlining.
public llvm::StringRef UserMode
public bool ShouldIncludeImplicitDtorsInCFG
public bool ShouldIncludeTemporaryDtorsInCFG
public bool ShouldIncludeLifetimeInCFG
public bool ShouldIncludeLoopExitInCFG
public bool ShouldIncludeRichConstructorsInCFG
public bool ShouldIncludeScopesInCFG
public bool ShouldIncludeDefaultInitForAggregates
public bool MayInlineTemplateFunctions
public bool MayInlineCXXStandardLibrary
public bool MayInlineCXXAllocator
public bool MayInlineCXXSharedPtrDtor
public bool MayInlineCXXTemporaryDtors
public bool ShouldSuppressNullReturnPaths
public bool ShouldAvoidSuppressingNullArgumentPaths
public bool ShouldSuppressInlinedDefensiveChecks
public bool MayInlineCXXContainerMethods
public bool ShouldSuppressFromCXXStandardLibrary
public bool ShouldCrosscheckWithZ3
public bool ShouldReportIssuesInMainSourceFile
public bool ShouldWriteStableReportFilename
public bool ShouldWriteVerboseReportFilename
public bool ShouldSerializeStats
public bool MayInlineObjCMethod
public bool ShouldPrunePaths
public bool ShouldAddPopUpNotes
public bool ShouldConditionalizeStaticInitializers
public bool ShouldSynthesizeBodies
public bool ShouldElideConstructors
public bool ShouldInlineLambdas
public bool ShouldWidenLoops
public bool ShouldUnrollLoops
public bool ShouldDisplayNotesAsEvents
public bool ShouldAggressivelySimplifyBinaryOperation
public bool ShouldEagerlyAssume
public bool IsNaiveCTUEnabled
public bool ShouldDisplayMacroExpansions
public bool DisplayCTUProgress
public bool ShouldTrackConditions
public bool ShouldTrackConditionsDebug
public bool ShouldApplyFixIts
public bool ShouldDisplayCheckerNameForText
public bool ShouldSupportSymbolicIntegerCasts
public bool ShouldConsiderSingleElementArraysAsFlexibleArrayMembers
public bool ShouldAssumeControlledEnvironment
public bool ShouldIgnoreBisonGeneratedFiles
public bool ShouldIgnoreFlexGeneratedFiles
public unsigned int CTUImportThreshold
public unsigned int CTUImportCppThreshold
public unsigned int AlwaysInlineSize
public unsigned int GraphTrimInterval
public unsigned int MinCFGSizeTreatFunctionsAsLarge
public unsigned int MaxSymbolComplexity
public unsigned int MaxTimesInlineLarge
public unsigned int MaxInlinableSize
public unsigned int MaxNodesPerTopLevelFunction
public unsigned int CTUMaxNodesPercentage
public unsigned int CTUMaxNodesMin
public llvm::StringRef CTUPhase1InliningMode
public unsigned int RegionStoreSmallStructLimit
public unsigned int RegionStoreSmallArrayLimit
public llvm::StringRef CTUDir
public llvm::StringRef CTUIndexName
public llvm::StringRef CTUInvocationList
public llvm::StringRef ModelPath
public llvm::StringRef CXXMemberInliningMode
public llvm::StringRef ExplorationStrategy
public llvm::StringRef RawSilencedCheckersAndPackages
public llvm::StringRef IPAMode
public std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = {llvm::StringLiteral("mode"), llvm::StringLiteral("cfg-implicit-dtors"), llvm::StringLiteral("cfg-temporary-dtors"), llvm::StringLiteral("cfg-lifetime"), llvm::StringLiteral("cfg-loopexit"), llvm::StringLiteral("cfg-rich-constructors"), llvm::StringLiteral("cfg-scopes"), llvm::StringLiteral("cfg-expand-default-aggr-inits"), llvm::StringLiteral("c++-template-inlining"), llvm::StringLiteral("c++-stdlib-inlining"), llvm::StringLiteral("c++-allocator-inlining"), llvm::StringLiteral("c++-shared_ptr-inlining"), llvm::StringLiteral("c++-temp-dtor-inlining"), llvm::StringLiteral("suppress-null-return-paths"), llvm::StringLiteral("avoid-suppressing-null-argument-paths"), llvm::StringLiteral("suppress-inlined-defensive-checks"), llvm::StringLiteral("c++-container-inlining"), llvm::StringLiteral("suppress-c++-stdlib"), llvm::StringLiteral("crosscheck-with-z3"), llvm::StringLiteral("report-in-main-source-file"), llvm::StringLiteral("stable-report-filename"), llvm::StringLiteral("verbose-report-filename"), llvm::StringLiteral("serialize-stats"), llvm::StringLiteral("objc-inlining"), llvm::StringLiteral("prune-paths"), llvm::StringLiteral("add-pop-up-notes"), llvm::StringLiteral("cfg-conditional-static-initializers"), llvm::StringLiteral("faux-bodies"), llvm::StringLiteral("elide-constructors"), llvm::StringLiteral("inline-lambdas"), llvm::StringLiteral("widen-loops"), llvm::StringLiteral("unroll-loops"), llvm::StringLiteral("notes-as-events"), llvm::StringLiteral("aggressive-binary-operation-simplification"), llvm::StringLiteral("eagerly-assume"), llvm::StringLiteral("experimental-enable-naive-ctu-analysis"), llvm::StringLiteral("expand-macros"), llvm::StringLiteral("display-ctu-progress"), llvm::StringLiteral("track-conditions"), llvm::StringLiteral("track-conditions-debug"), llvm::StringLiteral("apply-fixits"), llvm::StringLiteral("display-checker-name"), llvm::StringLiteral("support-symbolic-integer-casts"), llvm::StringLiteral("consider-single-element-arrays-as-flexible-array-members"), llvm::StringLiteral("assume-controlled-environment"), llvm::StringLiteral("ignore-bison-generated-files"), llvm::StringLiteral("ignore-flex-generated-files"), llvm::StringLiteral("ctu-import-threshold"), llvm::StringLiteral("ctu-import-cpp-threshold"), llvm::StringLiteral("ipa-always-inline-size"), llvm::StringLiteral("graph-trim-interval"), llvm::StringLiteral("min-cfg-size-treat-functions-as-large"), llvm::StringLiteral("max-symbol-complexity"), llvm::StringLiteral("max-times-inline-large"), llvm::StringLiteral("max-inlinable-size"), llvm::StringLiteral("max-nodes"), llvm::StringLiteral("ctu-max-nodes-pct"), llvm::StringLiteral("ctu-max-nodes-min"), llvm::StringLiteral("ctu-phase1-inlining"), llvm::StringLiteral("region-store-small-struct-limit"), llvm::StringLiteral("region-store-small-array-limit"), llvm::StringLiteral("ctu-dir"), llvm::StringLiteral("ctu-index-name"), llvm::StringLiteral("ctu-invocation-list"), llvm::StringLiteral("model-path"), llvm::StringLiteral("c++-inlining"), llvm::StringLiteral("exploration_strategy"), llvm::StringLiteral("silence-checkers"), llvm::StringLiteral("ipa")}

Method Overview

Methods

AnalyzerOptions()

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:287

clang::CTUPhase1InliningKind
getCTUPhase1Inlining() const

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:363

bool getCheckerBooleanOption(
    llvm::StringRef CheckerName,
    llvm::StringRef OptionName,
    bool SearchInParents = false) const

Description

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 \p DefaultVal.

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:315

Parameters

llvm::StringRef CheckerName
The *full name* of the checker. One may retrieve this from the checker object's field \c Name, or through \c CheckerManager::getCurrentCheckerName within the checker's registry function. Checker options are retrieved in the following format: `-analyzer-config CheckerName:OptionName=Value.
llvm::StringRef OptionName
Name for option to retrieve.
bool SearchInParents = false
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.

bool getCheckerBooleanOption(
    const ento::CheckerBase* C,
    llvm::StringRef OptionName,
    bool SearchInParents = false) const

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:318

Parameters

const ento::CheckerBase* C
llvm::StringRef OptionName
bool SearchInParents = false

int getCheckerIntegerOption(
    llvm::StringRef CheckerName,
    llvm::StringRef OptionName,
    bool SearchInParents = false) const

Description

Interprets an option's string value as an integer value. If an option value is not provided, returns the given \p DefaultVal.

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:335

Parameters

llvm::StringRef CheckerName
The *full name* of the checker. One may retrieve this from the checker object's field \c Name, or through \c CheckerManager::getCurrentCheckerName within the checker's registry function. Checker options are retrieved in the following format: `-analyzer-config CheckerName:OptionName=Value.
llvm::StringRef OptionName
Name for option to retrieve.
bool SearchInParents = false
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.

int getCheckerIntegerOption(
    const ento::CheckerBase* C,
    llvm::StringRef OptionName,
    bool SearchInParents = false) const

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:338

Parameters

const ento::CheckerBase* C
llvm::StringRef OptionName
bool SearchInParents = false

llvm::StringRef getCheckerStringOption(
    llvm::StringRef CheckerName,
    llvm::StringRef OptionName,
    bool SearchInParents = false) const

Description

Query an option's string value. If an option value is not provided, returns the given \p DefaultVal.

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:355

Parameters

llvm::StringRef CheckerName
The *full name* of the checker. One may retrieve this from the checker object's field \c Name, or through \c CheckerManager::getCurrentCheckerName within the checker's registry function. Checker options are retrieved in the following format: `-analyzer-config CheckerName:OptionName=Value.
llvm::StringRef OptionName
Name for option to retrieve.
bool SearchInParents = false
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.

llvm::StringRef getCheckerStringOption(
    const ento::CheckerBase* C,
    llvm::StringRef OptionName,
    bool SearchInParents = false) const

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:358

Parameters

const ento::CheckerBase* C
llvm::StringRef OptionName
bool SearchInParents = false

ento::PathDiagnosticConsumerOptions getDiagOpts()
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:376

clang::ExplorationStrategyKind
getExplorationStrategy() const

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:362

clang::IPAKind getIPAMode() const

Description

Returns the inter-procedural analysis mode.

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:366

static std::vector<StringRef>
getRegisteredCheckers(
    bool IncludeExperimental = false)

Description

Retrieves the list of checkers generated from Checkers.td. This doesn't contain statically linked but non-generated checkers and plugin checkers!

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:158

Parameters

bool IncludeExperimental = false

static std::vector<StringRef>
getRegisteredPackages(
    bool IncludeExperimental = false)

Description

Retrieves the list of packages generated from Checkers.td. This doesn't contain statically linked but non-generated packages and plugin packages!

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:163

Parameters

bool IncludeExperimental = false

bool isUnknownAnalyzerConfig(
    llvm::StringRef Name) const

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:280

Parameters

llvm::StringRef Name

bool mayInlineCXXMemberFunction(
    clang::CXXInlineableMemberKind K) const

Description

Returns the option controlling which C++ member functions will be considered for inlining. This is controlled by the 'c++-inlining' config option.

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:374

Parameters

clang::CXXInlineableMemberKind K

static void printFormattedEntry(
    llvm::raw_ostream& Out,
    std::pair<StringRef, StringRef> EntryDescPair,
    size_t InitialPad,
    size_t EntryWidth,
    size_t MinLineWidth = 0)

Description

Convenience function for printing options or checkers and their description in a formatted manner. If \p MinLineWidth is set to 0, no line breaks are introduced for the description. Format, depending whether the option name's length is less than\p EntryWidth: <padding >EntryName <padding >Description < ---------padding--------->Description < ---------padding--------->Description <padding >VeryVeryLongEntryName < ---------padding--------->Description < ---------padding--------->Description ^~~~~~~~~InitialPad ^~~~~~~~~~~~~~~~~~EntryWidth ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~MinLineWidth

Declared at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:182

Parameters

llvm::raw_ostream& Out
std::pair<StringRef, StringRef> EntryDescPair
size_t InitialPad
size_t EntryWidth
size_t MinLineWidth = 0