16#include "llvm/ADT/StringRef.h"
17#include "llvm/ADT/StringSwitch.h"
18#include "llvm/ADT/Twine.h"
19#include "llvm/Support/ErrorHandling.h"
20#include "llvm/Support/FormattedStream.h"
21#include "llvm/Support/raw_ostream.h"
32 llvm::raw_ostream &Out,
33 std::pair<StringRef, StringRef> EntryDescPair,
34 size_t InitialPad,
size_t EntryWidth,
size_t MinLineWidth) {
36 llvm::formatted_raw_ostream FOut(Out);
38 const size_t PadForDesc = InitialPad + EntryWidth;
41 FOut.PadToColumn(InitialPad);
43 FOut << EntryDescPair.first;
47 if (FOut.getColumn() >= PadForDesc)
50 FOut.PadToColumn(PadForDesc);
52 if (MinLineWidth == 0) {
53 FOut << EntryDescPair.second;
57 for (
char C : EntryDescPair.second) {
58 if (FOut.getColumn() > MinLineWidth &&
C ==
' ') {
60 FOut.PadToColumn(PadForDesc);
70 llvm::StringSwitch<std::optional<ExplorationStrategyKind>>(
75 .Case(
"unexplored_first_queue",
77 .Case(
"unexplored_first_location_queue",
79 .Case(
"bfs_block_dfs_contents",
81 .Default(std::nullopt);
82 assert(K &&
"User mode is invalid.");
87 auto K = llvm::StringSwitch<std::optional<CTUPhase1InliningKind>>(
88 CTUPhase1InliningMode)
92 .Default(std::nullopt);
93 assert(K &&
"CTU inlining mode is invalid.");
98 auto K = llvm::StringSwitch<std::optional<IPAKind>>(IPAMode)
104 .Default(std::nullopt);
105 assert(K &&
"IPA Mode is invalid.");
116 auto K = llvm::StringSwitch<std::optional<CXXInlineableMemberKind>>(
117 CXXMemberInliningMode)
122 .Default(std::nullopt);
124 assert(K &&
"Invalid c++ member function inlining mode.");
130 StringRef OptionName,
131 bool SearchInParents)
const {
132 assert(!CheckerName.empty() &&
133 "Empty checker name! Make sure the checker object (including it's "
134 "bases!) if fully initialized before calling this function!");
136 ConfigTable::const_iterator E =
Config.end();
138 ConfigTable::const_iterator I =
139 Config.find((Twine(CheckerName) +
":" + OptionName).str());
141 return StringRef(I->getValue());
142 size_t Pos = CheckerName.rfind(
'.');
143 if (Pos == StringRef::npos)
146 CheckerName = CheckerName.substr(0, Pos);
147 }
while (!CheckerName.empty() && SearchInParents);
149 llvm_unreachable(
"Unknown checker option! Did you call getChecker*Option "
150 "with incorrect parameters? User input must've been "
151 "verified by CheckerRegistry.");
157 StringRef OptionName,
158 bool SearchInParents)
const {
162bool AnalyzerOptions::getCheckerBooleanOption(StringRef CheckerName,
163 StringRef OptionName,
164 bool SearchInParents)
const {
166 llvm::StringSwitch<std::optional<bool>>(
169 .Case(
"false",
false)
170 .Default(std::nullopt);
173 "This option should be either 'true' or 'false', and should've been "
174 "validated by CheckerRegistry!");
180 StringRef OptionName,
181 bool SearchInParents)
const {
182 return getCheckerBooleanOption(
C->getName(), OptionName, SearchInParents);
186 StringRef OptionName,
187 bool SearchInParents)
const {
191 .getAsInteger(0, Ret);
193 "This option should be numeric, and should've been validated by "
200 StringRef OptionName,
201 bool SearchInParents)
const {
bool mayInlineCXXMemberFunction(CXXInlineableMemberKind K) const
Returns the option controlling which C++ member functions will be considered for inlining.
ConfigTable Config
A key-value table of use-specified configuration values.
IPAKind getIPAMode() const
Returns the inter-procedural analysis mode.
CTUPhase1InliningKind getCTUPhase1Inlining() const
int getCheckerIntegerOption(StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const
Interprets an option's string value as a boolean.
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.
The non-templated common ancestor of all the simple Checker<...> classes.
The JSON file list parser is used to communicate input to InstallAPI.
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...
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.
@ UnexploredFirstLocationQueue
Diagnostic wrappers for TextAPI types for error reporting.