11#include "llvm/ADT/Twine.h"
36 case StateFromCmdLine::State_Disabled:
38 case StateFromCmdLine::State_Enabled:
40 case StateFromCmdLine::State_Unspecified:
43 llvm_unreachable(
"Unhandled StateFromCmdLine enum");
56 Option.dumpToStream(Out);
59 Out <<
" Dependencies:\n";
61 Out <<
" " << Dependency->FullName <<
'\n';
63 Out <<
" Weak dependencies:\n";
65 Out <<
" " << Dependency->FullName <<
'\n';
76 Option.dumpToStream(Out);
85 if (!
Checker.FullName.starts_with(PackageName))
89 if (
Checker.FullName.size() == PackageName.size())
110 llvm::StringMap<size_t>::const_iterator PackageSize =
114 Size = PackageSize->getValue();
116 return {It, It + Size};
124 size_t MaxNameChars)
const {
127 Out <<
"CHECKERS:\n";
130 size_t OptionFieldWidth = 0;
134 size_t NameLength =
Checker.FullName.size();
135 if (NameLength <= MaxNameChars)
136 OptionFieldWidth = std::max(OptionFieldWidth, NameLength);
139 const size_t InitialPad = 2;
142 StringRef Description) {
144 InitialPad, OptionFieldWidth);
161 if (
Checker.FullName.starts_with(
"alpha")) {
164 (
"(Enable only for development!) " +
Checker.Desc).str());
175 Out << i->FullName <<
'\n';
179 raw_ostream &Out)
const {
180 Out <<
"OVERVIEW: Clang Static Analyzer Checker and Package Option List\n\n";
181 Out <<
"USAGE: -analyzer-config <OPTION1=VALUE,OPTION2=VALUE,...>\n\n";
182 Out <<
" -analyzer-config OPTION1=VALUE, -analyzer-config "
183 "OPTION2=VALUE, ...\n\n";
184 Out <<
"OPTIONS:\n\n";
188 std::multimap<StringRef, const CmdLineOption &> OptionMap;
192 OptionMap.insert({
Checker.FullName, Option});
198 OptionMap.insert({Package.FullName, Option});
202 auto Print = [](llvm::raw_ostream &Out, StringRef FullOption,
210 for (
const std::pair<const StringRef, const CmdLineOption &> &Entry :
213 std::string FullOption = (Entry.first +
":" + Option.
OptionName).str();
226 Print(Out, FullOption, Desc);
231 Entry.first.starts_with(
"alpha")) {
233 Print(Out, FullOption,
234 llvm::Twine(
"(Enable only for development!) " + Desc).str());
239 Print(Out, FullOption, Desc);
static constexpr char PackageSeparator
static bool isInPackage(const CheckerInfo &Checker, StringRef PackageName)
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Stores options for the analyzer from the command line.
unsigned ShowCheckerOptionDeveloperList
unsigned ShowCheckerHelpAlpha
unsigned ShowCheckerHelpDeveloper
unsigned ShowCheckerOptionList
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.
unsigned ShowCheckerOptionAlphaList
std::conditional_t< std::is_const< CheckerOrPackageInfoList >::value, typename CheckerOrPackageInfoList::const_iterator, typename CheckerOrPackageInfoList::iterator > binaryFind(CheckerOrPackageInfoList &Collection, StringRef FullName)
llvm::iterator_range< CheckerInfoList::iterator > CheckerInfoListRange
The JSON file list parser is used to communicate input to InstallAPI.
ConstCheckerInfoList WeakDependencies
ConstCheckerInfoList Dependencies
CmdLineOptionList CmdLineOptions
LLVM_DUMP_METHOD void dumpToStream(llvm::raw_ostream &Out) const
LLVM_DUMP_METHOD void dump() const
CheckerInfoListRange getMutableCheckersForCmdLineArg(StringRef CmdLineArg)
void printCheckerOptionList(const AnalyzerOptions &AnOpts, raw_ostream &Out) const
CheckerInfoSet EnabledCheckers
void printCheckerWithDescList(const AnalyzerOptions &AnOpts, raw_ostream &Out, size_t MaxNameChars=30) const
Prints the name and description of all checkers in this registry.
void printEnabledCheckerList(raw_ostream &Out) const
llvm::StringMap< size_t > PackageSizes
Used for counting how many checkers belong to a certain package in the Checkers field.
Specifies a command line option.
StringRef DevelopmentStatus
LLVM_DUMP_METHOD void dump() const
LLVM_DUMP_METHOD void dumpToStream(llvm::raw_ostream &Out) const
CmdLineOptionList CmdLineOptions
LLVM_DUMP_METHOD void dumpToStream(llvm::raw_ostream &Out) const
LLVM_DUMP_METHOD void dump() const