diff options
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(); |