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;
40 FOut.PadToColumn(InitialPad) << EntryDescPair.first;
42 if (FOut.getColumn() > PadForDesc)
45 FOut.PadToColumn(PadForDesc);
47 if (MinLineWidth == 0) {
48 FOut << EntryDescPair.second;
52 for (
char C : EntryDescPair.second) {
53 if (FOut.getColumn() > MinLineWidth &&
C ==
' ') {
55 FOut.PadToColumn(PadForDesc);
65 llvm::StringSwitch<std::optional<ExplorationStrategyKind>>(
70 .Case(
"unexplored_first_queue",
72 .Case(
"unexplored_first_location_queue",
74 .Case(
"bfs_block_dfs_contents",
76 .Default(std::nullopt);
77 assert(K &&
"User mode is invalid.");
82 auto K = llvm::StringSwitch<std::optional<CTUPhase1InliningKind>>(
83 CTUPhase1InliningMode)
87 .Default(std::nullopt);
88 assert(K &&
"CTU inlining mode is invalid.");
93 auto K = llvm::StringSwitch<std::optional<IPAKind>>(IPAMode)
99 .Default(std::nullopt);
100 assert(K &&
"IPA Mode is invalid.");
111 auto K = llvm::StringSwitch<std::optional<CXXInlineableMemberKind>>(
112 CXXMemberInliningMode)
117 .Default(std::nullopt);
119 assert(K &&
"Invalid c++ member function inlining mode.");
125 StringRef OptionName,
126 bool SearchInParents)
const {
127 assert(!CheckerName.empty() &&
128 "Empty checker name! Make sure the checker object (including it's "
129 "bases!) if fully initialized before calling this function!");
131 ConfigTable::const_iterator
E =
Config.end();
133 ConfigTable::const_iterator I =
134 Config.find((Twine(CheckerName) +
":" + OptionName).str());
136 return StringRef(I->getValue());
137 size_t Pos = CheckerName.rfind(
'.');
138 if (Pos == StringRef::npos)
141 CheckerName = CheckerName.substr(0, Pos);
142 }
while (!CheckerName.empty() && SearchInParents);
144 llvm_unreachable(
"Unknown checker option! Did you call getChecker*Option "
145 "with incorrect parameters? User input must've been "
146 "verified by CheckerRegistry.");
152 StringRef OptionName,
153 bool SearchInParents)
const {
158 StringRef OptionName,
159 bool SearchInParents)
const {
161 llvm::StringSwitch<std::optional<bool>>(
164 .Case(
"false",
false)
165 .Default(std::nullopt);
168 "This option should be either 'true' or 'false', and should've been "
169 "validated by CheckerRegistry!");
175 StringRef OptionName,
176 bool SearchInParents)
const {
181 StringRef OptionName,
182 bool SearchInParents)
const {
186 .getAsInteger(0, Ret);
188 "This option should be numeric, and should've been validated by "
195 StringRef OptionName,
196 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.
bool getCheckerBooleanOption(StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const
Interprets an option's string value as a boolean.
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 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.
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.