diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 23:08:48 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 23:08:48 +0000 |
commit | 0c22f1d5f9c99b5f25f93c7cc0fec8f020eff321 (patch) | |
tree | 210ea57e867060d52c8cb2f57f733560f55c737e /tools/clang | |
parent | ddf907ca0b39204d32a26829ed482a0ebcba2af9 (diff) | |
download | chromium_src-0c22f1d5f9c99b5f25f93c7cc0fec8f020eff321.zip chromium_src-0c22f1d5f9c99b5f25f93c7cc0fec8f020eff321.tar.gz chromium_src-0c22f1d5f9c99b5f25f93c7cc0fec8f020eff321.tar.bz2 |
style plugin: Don't suppress all warnings for checkouts in /usr/local/google
BUG=none
TEST=The plugin tests pass on my linux box.
Review URL: http://codereview.chromium.org/8369015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/clang')
-rw-r--r-- | tools/clang/plugins/ChromeClassTester.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp index f7b9e02..d1fd4f9a 100644 --- a/tools/clang/plugins/ChromeClassTester.cpp +++ b/tools/clang/plugins/ChromeClassTester.cpp @@ -19,6 +19,12 @@ bool starts_with(const std::string& one, const std::string& two) { return one.compare(0, two.size(), two) == 0; } +std::string lstrip(const std::string& one, const std::string& two) { + if (starts_with(one, two)) + return one.substr(two.size()); + return one; +} + bool ends_with(const std::string& one, const std::string& two) { if (two.size() > one.size()) return false; @@ -224,6 +230,11 @@ bool ChromeClassTester::InBannedDirectory(SourceLocation loc) { b = resolvedPath; } + // On linux, chrome is often checked out to /usr/local/google. Due to the + // "usr" rule in banned_directories_, all diagnostics would be suppressed + // in that case. As a workaround, strip that prefix. + b = lstrip(b, "/usr/local/google"); + for (std::vector<std::string>::const_iterator it = banned_directories_.begin(); it != banned_directories_.end(); ++it) { |