summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
diff options
context:
space:
mode:
authorKristof Umann <kristof.umann@ericsson.com>2019-05-23 20:47:28 +0000
committerKristof Umann <kristof.umann@ericsson.com>2019-05-23 20:47:28 +0000
commite8df27d9256b38ec1a2467a1b9c087b00ffd17cc (patch)
tree7b17d3776217690e58a62413e1e8d104d0b1c693 /clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
parentdab31924e9c790555f916d21e6575e7f1e1cd5b7 (diff)
downloadbcm5719-llvm-e8df27d9256b38ec1a2467a1b9c087b00ffd17cc.tar.gz
bcm5719-llvm-e8df27d9256b38ec1a2467a1b9c087b00ffd17cc.zip
[analyzer] Add a new frontend flag to display all checker options
Add the new frontend flag -analyzer-checker-option-help to display all checker/package options. Differential Revision: https://reviews.llvm.org/D57858 llvm-svn: 361552
Diffstat (limited to 'clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp51
1 files changed, 16 insertions, 35 deletions
diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
index 4ad362fe1e3..1e45ee96145 100644
--- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
@@ -18,7 +18,6 @@
#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
#include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/raw_ostream.h"
#include <memory>
@@ -65,17 +64,20 @@ void ento::printEnabledCheckerList(raw_ostream &out,
.printEnabledCheckerList(out);
}
+void ento::printCheckerConfigList(raw_ostream &OS,
+ ArrayRef<std::string> plugins,
+ AnalyzerOptions &opts,
+ DiagnosticsEngine &diags,
+ const LangOptions &LangOpts) {
+ CheckerRegistry(plugins, diags, opts, LangOpts)
+ .printCheckerOptionList(OS);
+}
+
void ento::printAnalyzerConfigList(raw_ostream &out) {
out << "OVERVIEW: Clang Static Analyzer -analyzer-config Option List\n\n";
- out << "USAGE: clang -cc1 [CLANG_OPTIONS] -analyzer-config "
- "<OPTION1=VALUE,OPTION2=VALUE,...>\n\n";
- out << " clang -cc1 [CLANG_OPTIONS] -analyzer-config OPTION1=VALUE, "
- "-analyzer-config OPTION2=VALUE, ...\n\n";
- out << " clang [CLANG_OPTIONS] -Xclang -analyzer-config -Xclang"
- "<OPTION1=VALUE,OPTION2=VALUE,...>\n\n";
- out << " clang [CLANG_OPTIONS] -Xclang -analyzer-config -Xclang "
- "OPTION1=VALUE, -Xclang -analyzer-config -Xclang "
- "OPTION2=VALUE, ...\n\n";
+ out << "USAGE: -analyzer-config <OPTION1=VALUE,OPTION2=VALUE,...>\n\n";
+ out << " -analyzer-config OPTION1=VALUE, -analyzer-config "
+ "OPTION2=VALUE, ...\n\n";
out << "OPTIONS:\n\n";
using OptionAndDescriptionTy = std::pair<StringRef, std::string>;
@@ -109,31 +111,10 @@ void ento::printAnalyzerConfigList(raw_ostream &out) {
return LHS.first < RHS.first;
});
- constexpr size_t MinLineWidth = 70;
- constexpr size_t PadForOpt = 2;
- constexpr size_t OptionWidth = 30;
- constexpr size_t PadForDesc = PadForOpt + OptionWidth;
- static_assert(MinLineWidth > PadForDesc, "MinLineWidth must be greater!");
-
- llvm::formatted_raw_ostream FOut(out);
-
for (const auto &Pair : PrintableOptions) {
- FOut.PadToColumn(PadForOpt) << Pair.first;
-
- // If the buffer's length is greater then PadForDesc, print a newline.
- if (FOut.getColumn() > PadForDesc)
- FOut << '\n';
-
- FOut.PadToColumn(PadForDesc);
-
- for (char C : Pair.second) {
- if (FOut.getColumn() > MinLineWidth && C == ' ') {
- FOut << '\n';
- FOut.PadToColumn(PadForDesc);
- continue;
- }
- FOut << C;
- }
- FOut << "\n\n";
+ AnalyzerOptions::printFormattedEntry(out, Pair, /*InitialPad*/ 2,
+ /*EntryWidth*/ 30,
+ /*MinLineWidth*/ 70);
+ out << "\n\n";
}
}
OpenPOWER on IntegriCloud