20 #include "llvm/ADT/SmallVector.h" 21 #include "llvm/Support/raw_ostream.h" 24 using namespace clang;
33 auto checkerMgr = llvm::make_unique<CheckerManager>(context, opts);
35 CheckerRegistry allCheckers(plugins, diags, opts, context.getLangOpts(),
36 checkerRegistrationFns);
38 allCheckers.initializeManager(*checkerMgr);
39 allCheckers.validateCheckerOptions();
40 checkerMgr->finishedCheckerRegistration();
49 out <<
"OVERVIEW: Clang Static Analyzer Checkers List\n\n";
50 out <<
"USAGE: -analyzer-checker <CHECKER or PACKAGE,...>\n\n";
61 out <<
"OVERVIEW: Clang Static Analyzer Enabled Checkers List\n\n";
77 out <<
"OVERVIEW: Clang Static Analyzer -analyzer-config Option List\n\n";
78 out <<
"USAGE: -analyzer-config <OPTION1=VALUE,OPTION2=VALUE,...>\n\n";
79 out <<
" -analyzer-config OPTION1=VALUE, -analyzer-config " 80 "OPTION2=VALUE, ...\n\n";
81 out <<
"OPTIONS:\n\n";
83 using OptionAndDescriptionTy = std::pair<StringRef, std::string>;
84 OptionAndDescriptionTy PrintableOptions[] = {
85 #define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \ 88 llvm::Twine(llvm::Twine() + "(" + \ 89 (StringRef(#TYPE) == "StringRef" ? "string" : #TYPE ) + \ 91 " (default: " #DEFAULT_VAL ")").str() \ 94 #define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \ 95 SHALLOW_VAL, DEEP_VAL) \ 98 llvm::Twine(llvm::Twine() + "(" + \ 99 (StringRef(#TYPE) == "StringRef" ? "string" : #TYPE ) + \ 101 " (default: " #SHALLOW_VAL " in shallow mode, " #DEEP_VAL \ 102 " in deep mode)").str() \ 104 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.def" 105 #undef ANALYZER_OPTION 106 #undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE 109 llvm::sort(PrintableOptions, [](
const OptionAndDescriptionTy &LHS,
110 const OptionAndDescriptionTy &RHS) {
111 return LHS.first < RHS.first;
114 for (
const auto &Pair : PrintableOptions) {
Manages a set of available checkers for running a static analysis.
void printEnabledCheckerList(raw_ostream &OS, ArrayRef< std::string > plugins, AnalyzerOptions &opts, DiagnosticsEngine &diags, const LangOptions &LangOpts)
void printCheckerWithDescList(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
void printAnalyzerConfigList(raw_ostream &OS)
std::unique_ptr< CheckerManager > createCheckerManager(ASTContext &context, AnalyzerOptions &opts, ArrayRef< std::string > plugins, ArrayRef< std::function< void(CheckerRegistry &)>> checkerRegistrationFns, DiagnosticsEngine &diags)
static void printFormattedEntry(llvm::raw_ostream &Out, std::pair< StringRef, StringRef > EntryDescPair, size_t EntryWidth, size_t InitialPad, size_t MinLineWidth=0)
Convenience function for printing options or checkers and their description in a formatted manner...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
void printCheckerHelp(raw_ostream &OS, ArrayRef< std::string > plugins, AnalyzerOptions &opts, DiagnosticsEngine &diags, const LangOptions &LangOpts)
Concrete class used by the front-end to report problems and issues.
Defines the Diagnostic-related interfaces.
void printCheckerConfigList(raw_ostream &OS, ArrayRef< std::string > plugins, AnalyzerOptions &opts, DiagnosticsEngine &diags, const LangOptions &LangOpts)
void printCheckerOptionList(raw_ostream &Out) const
Dataflow Directional Tag Classes.
Stores options for the analyzer from the command line.