summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2015-03-11 17:25:22 +0000
committerGabor Horvath <xazax.hun@gmail.com>2015-03-11 17:25:22 +0000
commit343832181b853eaf703dfc929a3eb1acc35fa7bf (patch)
tree225ff0ef542df3153eb88211022e98c9d038d1ab /clang-tools-extra/clang-tidy
parent29f342c6b5085d8d4221a346f59e58198ce6dd33 (diff)
downloadbcm5719-llvm-343832181b853eaf703dfc929a3eb1acc35fa7bf.tar.gz
bcm5719-llvm-343832181b853eaf703dfc929a3eb1acc35fa7bf.zip
[clang-tidy] Static Analyzer checker configuration options pass-through.
Reviewed by: Alexander Kornienko Differential Revision: http://reviews.llvm.org/D8164 llvm-svn: 231941
Diffstat (limited to 'clang-tools-extra/clang-tidy')
-rw-r--r--clang-tools-extra/clang-tidy/ClangTidy.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index b8afc08d784..1460e8cfcdf 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -204,6 +204,17 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
}
}
+static void setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
+ AnalyzerOptionsRef AnalyzerOptions) {
+ StringRef AnalyzerPrefix(AnalyzerCheckNamePrefix);
+ for (const auto &Opt : Opts.CheckOptions) {
+ StringRef OptName(Opt.first);
+ if (!OptName.startswith(AnalyzerPrefix))
+ continue;
+ AnalyzerOptions->Config[OptName.substr(AnalyzerPrefix.size())] = Opt.second;
+ }
+}
+
std::unique_ptr<clang::ASTConsumer>
ClangTidyASTConsumerFactory::CreateASTConsumer(
clang::CompilerInstance &Compiler, StringRef File) {
@@ -241,6 +252,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
GlobList &Filter = Context.getChecksFilter();
AnalyzerOptions->CheckersControlList = getCheckersControlList(Filter);
if (!AnalyzerOptions->CheckersControlList.empty()) {
+ setStaticAnalyzerCheckerOpts(Context.getOptions(), AnalyzerOptions);
AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;
AnalyzerOptions->AnalysisDiagOpt = PD_NONE;
AnalyzerOptions->AnalyzeNestedBlocks = true;
OpenPOWER on IntegriCloud