summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-04 04:40:32 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-04 04:40:32 +0000
commit4696bad1717189c7936d7e3cbbe4a622243d76fa (patch)
treee4691225fd02a987eecc1de15ff0b734759d86cf
parent9f9bb4144867f679e6682833d17e4e112e3abc9c (diff)
downloadchromium_src-4696bad1717189c7936d7e3cbbe4a622243d76fa.zip
chromium_src-4696bad1717189c7936d7e3cbbe4a622243d76fa.tar.gz
chromium_src-4696bad1717189c7936d7e3cbbe4a622243d76fa.tar.bz2
Add cc/ to banned_directories in chromium clang style checker
The chromium compositor code will be imported from WebKit into this directory soon. Since it's WebKit style, it doesn't currently adhere to all of the clang style checks. This adds a temporary exemption so we don't spam the heck out of everyone while we clean things up. BUG=none NOTRY=true Review URL: https://chromiumcodereview.appspot.com/10853012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150013 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--tools/clang/plugins/ChromeClassTester.cpp9
-rw-r--r--tools/clang/plugins/ChromeClassTester.h6
-rw-r--r--tools/clang/plugins/FindBadConstructs.cpp13
3 files changed, 21 insertions, 7 deletions
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp
index c61271b..f32fbf1 100644
--- a/tools/clang/plugins/ChromeClassTester.cpp
+++ b/tools/clang/plugins/ChromeClassTester.cpp
@@ -37,10 +37,12 @@ bool ends_with(const std::string& one, const std::string& two) {
} // namespace
ChromeClassTester::ChromeClassTester(CompilerInstance& instance,
- bool check_inner_classes)
+ bool check_inner_classes,
+ bool check_cc_directory)
: instance_(instance),
diagnostic_(instance.getDiagnostics()),
- check_inner_classes_(check_inner_classes) {
+ check_inner_classes_(check_inner_classes),
+ check_cc_directory_(check_cc_directory) {
BuildBannedLists();
}
@@ -163,6 +165,9 @@ void ChromeClassTester::BuildBannedLists() {
banned_directories_.push_back("icu4c/");
banned_directories_.push_back("frameworks/");
+ if (!check_cc_directory_)
+ banned_directories_.push_back("cc/");
+
// Don't check autogenerated headers.
// Make puts them below $(builddir_name)/.../gen and geni.
// Ninja puts them below OUTPUT_DIR/.../gen
diff --git a/tools/clang/plugins/ChromeClassTester.h b/tools/clang/plugins/ChromeClassTester.h
index fe11fcd..07ead95 100644
--- a/tools/clang/plugins/ChromeClassTester.h
+++ b/tools/clang/plugins/ChromeClassTester.h
@@ -17,7 +17,8 @@
class ChromeClassTester : public clang::ASTConsumer {
public:
explicit ChromeClassTester(clang::CompilerInstance& instance,
- bool check_inner_classes);
+ bool check_inner_classes,
+ bool check_cc_directory);
virtual ~ChromeClassTester();
// clang::ASTConsumer:
@@ -83,6 +84,9 @@ class ChromeClassTester : public clang::ASTConsumer {
// TODO: Remove once all inner classes are cleaned up.
bool check_inner_classes_;
+
+ // TODO(jamesr): Remove once cc/ directory compiles without warnings.
+ bool check_cc_directory_;
};
#endif // TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_
diff --git a/tools/clang/plugins/FindBadConstructs.cpp b/tools/clang/plugins/FindBadConstructs.cpp
index b9e1f5b..0c41d7c 100644
--- a/tools/clang/plugins/FindBadConstructs.cpp
+++ b/tools/clang/plugins/FindBadConstructs.cpp
@@ -51,8 +51,9 @@ class FindBadConstructsConsumer : public ChromeClassTester {
FindBadConstructsConsumer(CompilerInstance& instance,
bool check_refcounted_dtors,
bool check_virtuals_in_implementations,
- bool check_inner_classes)
- : ChromeClassTester(instance, check_inner_classes),
+ bool check_inner_classes,
+ bool check_cc_directory)
+ : ChromeClassTester(instance, check_inner_classes, check_cc_directory),
check_refcounted_dtors_(check_refcounted_dtors),
check_virtuals_in_implementations_(check_virtuals_in_implementations) {
}
@@ -397,7 +398,8 @@ class FindBadConstructsAction : public PluginASTAction {
FindBadConstructsAction()
: check_refcounted_dtors_(true),
check_virtuals_in_implementations_(true),
- check_inner_classes_(false) {
+ check_inner_classes_(false),
+ check_cc_directory_(false) {
}
protected:
@@ -406,7 +408,7 @@ class FindBadConstructsAction : public PluginASTAction {
llvm::StringRef ref) {
return new FindBadConstructsConsumer(
instance, check_refcounted_dtors_, check_virtuals_in_implementations_,
- check_inner_classes_);
+ check_inner_classes_, check_cc_directory_);
}
virtual bool ParseArgs(const CompilerInstance& instance,
@@ -420,6 +422,8 @@ class FindBadConstructsAction : public PluginASTAction {
check_virtuals_in_implementations_ = false;
} else if (args[i] == "check-inner-classes") {
check_inner_classes_ = true;
+ } else if (args[i] == "check-cc-directory") {
+ check_cc_directory_ = true;
} else {
parsed = false;
llvm::errs() << "Unknown argument: " << args[i] << "\n";
@@ -433,6 +437,7 @@ class FindBadConstructsAction : public PluginASTAction {
bool check_refcounted_dtors_;
bool check_virtuals_in_implementations_;
bool check_inner_classes_;
+ bool check_cc_directory_;
};
} // namespace