Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: tools/clang/plugins/ChromeClassTester.cpp

Issue 1072203002: Build the Clang plugin on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Win path checking and comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/clang/plugins/CMakeLists.txt ('k') | tools/clang/plugins/FindBadConstructsConsumer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/plugins/ChromeClassTester.cpp
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp
index a08ead4bd5d39f6c885d0ec2f7648451d14464c5..2c83578135563ed6a529e8b47b23e5f9e8104376 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"
@@ -129,83 +131,90 @@ bool ChromeClassTester::InImplementationFile(SourceLocation record_location) {
}
void ChromeClassTester::BuildBannedLists() {
- banned_namespaces_.push_back("std");
- banned_namespaces_.push_back("__gnu_cxx");
-
- banned_namespaces_.push_back("blink");
- banned_namespaces_.push_back("WTF");
-
- banned_directories_.push_back("/third_party/");
- banned_directories_.push_back("/native_client/");
- banned_directories_.push_back("/breakpad/");
- banned_directories_.push_back("/courgette/");
- banned_directories_.push_back("/pdf/");
- banned_directories_.push_back("/ppapi/");
- banned_directories_.push_back("/usr/include/");
- banned_directories_.push_back("/usr/lib/");
- banned_directories_.push_back("/usr/local/include/");
- banned_directories_.push_back("/usr/local/lib/");
- banned_directories_.push_back("/testing/");
- banned_directories_.push_back("/v8/");
- banned_directories_.push_back("/dart/");
- banned_directories_.push_back("/sdch/");
- banned_directories_.push_back("/icu4c/");
- banned_directories_.push_back("/frameworks/");
+ banned_namespaces_.emplace_back("std");
+ banned_namespaces_.emplace_back("__gnu_cxx");
+
+ banned_namespaces_.emplace_back("blink");
+ banned_namespaces_.emplace_back("WTF");
+
+ // System headers:
+#if defined(LLVM_ON_UNIX)
+ banned_directories_.emplace_back("/usr/include/");
+ banned_directories_.emplace_back("/usr/lib/");
+ banned_directories_.emplace_back("/usr/local/include/");
+ banned_directories_.emplace_back("/usr/local/lib/");
+#elif defined(LLVM_ON_WIN32)
+ // For now, assume that only win_toolchain will be used with clang=1.
+ banned_directories_.emplace_back("/win_toolchain/");
Nico 2015/04/11 23:32:31 clang-cl should konw that stuff in win_toolchain a
dcheng 2015/04/12 03:28:58 Interesting, didn't know about that. I updated InB
+#endif
+
+ banned_directories_.emplace_back("/third_party/");
+ banned_directories_.emplace_back("/native_client/");
+ banned_directories_.emplace_back("/breakpad/");
+ banned_directories_.emplace_back("/courgette/");
+ banned_directories_.emplace_back("/pdf/");
+ banned_directories_.emplace_back("/ppapi/");
+ banned_directories_.emplace_back("/testing/");
+ banned_directories_.emplace_back("/v8/");
+ banned_directories_.emplace_back("/dart/");
+ banned_directories_.emplace_back("/sdch/");
+ banned_directories_.emplace_back("/icu4c/");
+ banned_directories_.emplace_back("/frameworks/");
// Don't check autogenerated headers.
// Make puts them below $(builddir_name)/.../gen and geni.
// Ninja puts them below OUTPUT_DIR/.../gen
// Xcode has a fixed output directory for everything.
- banned_directories_.push_back("/gen/");
- banned_directories_.push_back("/geni/");
- banned_directories_.push_back("/xcodebuild/");
+ banned_directories_.emplace_back("/gen/");
+ banned_directories_.emplace_back("/geni/");
+ banned_directories_.emplace_back("/xcodebuild/");
// You are standing in a mazy of twisty dependencies, all resolved by
// putting everything in the header.
- banned_directories_.push_back("/automation/");
+ banned_directories_.emplace_back("/automation/");
// Don't check system headers.
- banned_directories_.push_back("/Developer/");
+ banned_directories_.emplace_back("/Developer/");
// Used in really low level threading code that probably shouldn't be out of
// lined.
- ignored_record_names_.insert("ThreadLocalBoolean");
+ ignored_record_names_.emplace("ThreadLocalBoolean");
// A complicated pickle derived struct that is all packed integers.
- ignored_record_names_.insert("Header");
+ ignored_record_names_.emplace("Header");
// Part of the GPU system that uses multiple included header
// weirdness. Never getting this right.
- ignored_record_names_.insert("Validators");
+ ignored_record_names_.emplace("Validators");
// Has a UNIT_TEST only constructor. Isn't *terribly* complex...
- ignored_record_names_.insert("AutocompleteController");
- ignored_record_names_.insert("HistoryURLProvider");
+ ignored_record_names_.emplace("AutocompleteController");
+ ignored_record_names_.emplace("HistoryURLProvider");
// Because of chrome frame
- ignored_record_names_.insert("ReliabilityTestSuite");
+ ignored_record_names_.emplace("ReliabilityTestSuite");
// Used over in the net unittests. A large enough bundle of integers with 1
// non-pod class member. Probably harmless.
- ignored_record_names_.insert("MockTransaction");
+ ignored_record_names_.emplace("MockTransaction");
// Enum type with _LAST members where _LAST doesn't mean last enum value.
- ignored_record_names_.insert("ServerFieldType");
+ ignored_record_names_.emplace("ServerFieldType");
// Used heavily in ui_base_unittests and once in views_unittests. Fixing this
// isn't worth the overhead of an additional library.
- ignored_record_names_.insert("TestAnimationDelegate");
+ ignored_record_names_.emplace("TestAnimationDelegate");
// Part of our public interface that nacl and friends use. (Arguably, this
// should mean that this is a higher priority but fixing this looks hard.)
- ignored_record_names_.insert("PluginVersionInfo");
+ ignored_record_names_.emplace("PluginVersionInfo");
// Measured performance improvement on cc_perftests. See
// https://codereview.chromium.org/11299290/
- ignored_record_names_.insert("QuadF");
+ ignored_record_names_.emplace("QuadF");
// Enum type with _LAST members where _LAST doesn't mean last enum value.
- ignored_record_names_.insert("ViewID");
+ ignored_record_names_.emplace("ViewID");
}
std::string ChromeClassTester::GetNamespaceImpl(const DeclContext* context,
@@ -250,7 +259,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 +269,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.
« no previous file with comments | « tools/clang/plugins/CMakeLists.txt ('k') | tools/clang/plugins/FindBadConstructsConsumer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698