summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/google
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-10-16 11:27:57 +0000
committerAlexander Kornienko <alexfh@google.com>2014-10-16 11:27:57 +0000
commit1efc425551c0c7ac95cacad8f63dc31eb46c1f04 (patch)
treef1abd4eee68b1245551d67fcb968d46b64700efc /clang-tools-extra/clang-tidy/google
parent0445380f4f6f40c56871147d207cb3bf85529967 (diff)
downloadbcm5719-llvm-1efc425551c0c7ac95cacad8f63dc31eb46c1f04.tar.gz
bcm5719-llvm-1efc425551c0c7ac95cacad8f63dc31eb46c1f04.zip
[clang-tidy] Default options in modules.
Summary: This patch allows modules to specify default options for the checks defined in them. This way a sufficiently configurable check can be registered in multiple modules with different default options. E.g. the SpacesBeforeComments option may be set to 1 for the "llvm-namespace-comments" check and to 2 for the "google-readability-namespace-comment" check without modifying or extending the check code. This patch also registers the google-readability-braces-around-statements check with suitable defaults. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5798 llvm-svn: 219923
Diffstat (limited to 'clang-tools-extra/clang-tidy/google')
-rw-r--r--clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
index b839fd0e55e..9ff5caec377 100644
--- a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
@@ -21,6 +21,7 @@
#include "TodoCommentCheck.h"
#include "UnnamedNamespaceInHeaderCheck.h"
#include "UsingNamespaceDirectiveCheck.h"
+#include "../readability/BracesAroundStatementsCheck.h"
#include "../readability/NamespaceCommentCheck.h"
using namespace clang::ast_matchers;
@@ -55,6 +56,18 @@ public:
"google-readability-todo");
CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
"google-readability-namespace-comments");
+ CheckFactories.registerCheck<readability::BracesAroundStatementsCheck>(
+ "google-readability-braces-around-statements");
+ }
+
+ ClangTidyOptions getModuleOptions() override {
+ ClangTidyOptions Options;
+ auto &Opts = Options.CheckOptions;
+ Opts["google-readability-braces-around-statements.ShortStatementLines"] =
+ "1";
+ Opts["google-readability-namespace-comments.ShortNamespaceLines"] = "1";
+ Opts["google-readability-namespace-comments.SpacesBeforeComments"] = "2";
+ return Options;
}
};
OpenPOWER on IntegriCloud