Index: tools/clang/plugins/ChromeClassTester.cpp |
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp |
index a08ead4bd5d39f6c885d0ec2f7648451d14464c5..e9a0bcac479cae3b7d87a100f87a1b5f9c812504 100644 |
--- a/tools/clang/plugins/ChromeClassTester.cpp |
+++ b/tools/clang/plugins/ChromeClassTester.cpp |
@@ -7,6 +7,8 @@ |
#include "ChromeClassTester.h" |
+#include <algorithm> |
+ |
#include "clang/AST/AST.h" |
#include "clang/Basic/FileManager.h" |
#include "clang/Basic/SourceManager.h" |
@@ -232,6 +234,9 @@ std::string ChromeClassTester::GetNamespaceImpl(const DeclContext* context, |
} |
bool ChromeClassTester::InBannedDirectory(SourceLocation loc) { |
+ if (instance().getSourceManager().isInSystemHeader(loc)) |
+ return true; |
+ |
std::string filename; |
if (!GetFilename(loc, &filename)) { |
// If the filename cannot be determined, simply treat this as a banned |
@@ -250,7 +255,7 @@ bool ChromeClassTester::InBannedDirectory(SourceLocation loc) { |
return true; |
} |
-#ifdef LLVM_ON_UNIX |
+#if defined(LLVM_ON_UNIX) |
// We need to munge the paths so that they are relative to the repository |
// srcroot. We first resolve the symlinktastic relative path and then |
// remove our known srcroot from it if needed. |
@@ -260,6 +265,10 @@ bool ChromeClassTester::InBannedDirectory(SourceLocation loc) { |
} |
#endif |
+#if defined(LLVM_ON_WIN32) |
+ std::replace(filename.begin(), filename.end(), '\\', '/'); |
+#endif |
+ |
for (const std::string& banned_dir : banned_directories_) { |
// If any of the banned directories occur as a component in filename, |
// this file is rejected. |