17 #include "llvm/ADT/SmallString.h" 18 #include "llvm/ADT/StringSwitch.h" 19 #include "llvm/ADT/StringRef.h" 20 #include "llvm/ADT/Twine.h" 21 #include "llvm/Support/ErrorHandling.h" 22 #include "llvm/Support/FileSystem.h" 23 #include "llvm/Support/raw_ostream.h" 29 using namespace clang;
33 std::vector<StringRef>
35 static const StringRef StaticAnalyzerChecks[] = {
37 #define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI) \ 39 #include "clang/StaticAnalyzer/Checkers/Checkers.inc" 43 std::vector<StringRef> Result;
44 for (StringRef CheckName : StaticAnalyzerChecks) {
45 if (!CheckName.startswith(
"debug.") &&
46 (IncludeExperimental || !CheckName.startswith(
"alpha.")))
47 Result.push_back(CheckName);
55 llvm::StringSwitch<llvm::Optional<ExplorationStrategyKind>>(
59 .Case(
"unexplored_first",
61 .Case(
"unexplored_first_queue",
63 .Case(
"unexplored_first_location_queue",
65 .Case(
"bfs_block_dfs_contents",
68 assert(K.hasValue() &&
"User mode is invalid.");
73 auto K = llvm::StringSwitch<llvm::Optional<IPAKind>>(IPAMode)
80 assert(K.hasValue() &&
"IPA Mode is invalid.");
92 llvm::StringSwitch<llvm::Optional<CXXInlineableMemberKind>>(
93 CXXMemberInliningMode)
100 assert(K.hasValue() &&
"Invalid c++ member function inlining mode.");
106 StringRef DefaultVal,
107 const CheckerBase *C,
108 bool SearchInParents)
const {
112 StringRef CheckerName = C->getTagDescription();
114 assert(!CheckerName.empty() &&
115 "Empty checker name! Make sure the checker object (including it's " 116 "bases!) if fully initialized before calling this function!");
117 ConfigTable::const_iterator E = Config.end();
119 ConfigTable::const_iterator I =
120 Config.find((Twine(CheckerName) +
":" + OptionName).
str());
122 return StringRef(I->getValue());
123 size_t Pos = CheckerName.rfind(
'.');
124 if (Pos == StringRef::npos)
126 CheckerName = CheckerName.substr(0, Pos);
127 }
while (!CheckerName.empty() && SearchInParents);
132 const CheckerBase *C,
133 bool SearchInParents)
const {
138 return llvm::StringSwitch<bool>(
139 getCheckerStringOption(Name, DefaultVal ?
"true" :
"false", C,
142 .Case(
"false",
false)
143 .Default(DefaultVal);
147 const CheckerBase *C,
148 bool SearchInParents)
const {
149 int Ret = DefaultVal;
150 bool HasFailed = getCheckerStringOption(Name, std::to_string(DefaultVal), C,
152 .getAsInteger(10, Ret);
153 assert(!HasFailed &&
"analyzer-config option should be numeric");
Inline C functions and blocks when their definitions are available.
IPAKind
Describes the different modes of inter-procedural analysis.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
int getCheckerIntegerOption(StringRef Name, int DefaultVal, const ento::CheckerBase *C, bool SearchInParents=false) const
Interprets an option's string value as an integer value.
Perform only intra-procedural analysis.
A dummy mode in which no C++ inlining is enabled.
Inline callees(C, C++, ObjC) when their definitions are available.
bool getCheckerBooleanOption(StringRef Name, bool DefaultVal, const ento::CheckerBase *C, bool SearchInParents=false) const
Interprets an option's string value as a boolean.
static std::vector< StringRef > getRegisteredCheckers(bool IncludeExperimental=false)
Refers to regular member function and operator calls.
Refers to constructors (implicit or explicit).
Enable inlining of dynamically dispatched methods.
IPAKind getIPAMode() const
Returns the inter-procedural analysis mode.
Refers to destructors (implicit or explicit).
ExplorationStrategyKind getExplorationStrategy() const
Dataflow Directional Tag Classes.
StringRef getCheckerStringOption(StringRef Name, StringRef DefaultVal, const ento::CheckerBase *C, bool SearchInParents=false) const
Query an option's string value.
bool mayInlineCXXMemberFunction(CXXInlineableMemberKind K) const
Returns the option controlling which C++ member functions will be considered for inlining.
CXXInlineableMemberKind
Describes the different kinds of C++ member functions which can be considered for inlining by the ana...
Enable inlining of dynamically dispatched methods, bifurcate paths when exact type info is unavailabl...