diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 21:07:45 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 21:07:45 +0000 |
commit | 22ea1c506a5995227e96b268e1c6c72d89bd2726 (patch) | |
tree | a48b81d2a4ba1d825a4ca140aecea6ab9c43717e /tools/clang | |
parent | 105edb4369f75aaf3edc990eff0fab64defaef32 (diff) | |
download | chromium_src-22ea1c506a5995227e96b268e1c6c72d89bd2726.zip chromium_src-22ea1c506a5995227e96b268e1c6c72d89bd2726.tar.gz chromium_src-22ea1c506a5995227e96b268e1c6c72d89bd2726.tar.bz2 |
Modify how we clean paths in clang plugins.
On the mac, paths will have a bunch of "../.././" garbage to make a relative
path relative to the root of the repository. Clean this up by removing all
period and slash characters in a path.
BUG=none
TEST=cuts down on false positives in paths that are blacklisted in clang output
Review URL: http://codereview.chromium.org/6525023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/clang')
-rw-r--r-- | tools/clang/plugins/ChromeClassTester.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp index d98a44c..6e5e874 100644 --- a/tools/clang/plugins/ChromeClassTester.cpp +++ b/tools/clang/plugins/ChromeClassTester.cpp @@ -176,9 +176,15 @@ bool ChromeClassTester::InBannedDirectory(const SourceLocation& loc) { return true; } - // Strip preceding path crap. - if (starts_with(b, "./")) - b = b.substr(2); + // Strip out all preceding path garbage. Linux and mac builds have + // different path garbage, but after doing this, the path should be + // relative to the root of the source tree. (If we didn't require + // relative paths, we could have just used realpath().) + if (!b.empty() && b[0] != '/') { + size_t i = 0; + for (; i < b.size() && (b[i] == '.' || b[i] == '/'); ++i) {} + b = b.substr(i); + } for (std::vector<std::string>::const_iterator it = banned_directories_.begin(); |