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

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

Issue 2749043004: Clang plugin: Support for Blink in web/. (Closed)
Patch Set: namespace approach Created 3 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/ChromeClassTester.h ('k') | tools/clang/plugins/FindBadConstructsConsumer.h » ('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 c9388067234f44a1985587dd660edfd1417b1e1c..e7c4285110a1d4eb6f90c12a99d04c67b0aaa9ed 100644
--- a/tools/clang/plugins/ChromeClassTester.cpp
+++ b/tools/clang/plugins/ChromeClassTester.cpp
@@ -52,7 +52,7 @@ void ChromeClassTester::CheckTag(TagDecl* tag) {
return;
SourceLocation location = tag->getInnerLocStart();
- LocationType location_type = ClassifyLocation(location);
+ LocationType location_type = ClassifyLocation(location, tag);
if (location_type == LocationType::kThirdParty)
return;
@@ -96,7 +96,12 @@ void ChromeClassTester::emitWarning(SourceLocation loc,
}
ChromeClassTester::LocationType ChromeClassTester::ClassifyLocation(
- SourceLocation loc) {
+ SourceLocation loc,
+ const Decl* record) {
+ std::string ns = GetNamespace(record);
+ if (ns == "blink" || ns == "WTF")
+ return LocationType::kBlink;
+
if (instance().getSourceManager().isInSystemHeader(loc))
return LocationType::kThirdParty;
@@ -157,16 +162,6 @@ ChromeClassTester::LocationType ChromeClassTester::ClassifyLocation(
std::replace(filename.begin(), filename.end(), '\\', '/');
#endif
- for (const std::string& blink_dir : blink_directories_) {
- // If any of the allowed directories occur as a component in filename,
- // this file is allowed.
- assert(blink_dir.front() == '/' && "Allowed dir must start with '/'");
- assert(blink_dir.back() == '/' && "Allowed dir must end with '/'");
-
- if (filename.find(blink_dir) != std::string::npos)
- return LocationType::kBlink;
- }
-
for (const std::string& banned_dir : banned_directories_) {
// If any of the banned directories occur as a component in filename,
// this file is rejected.
@@ -233,8 +228,6 @@ void ChromeClassTester::BuildBannedLists() {
banned_namespaces_.emplace("std");
banned_namespaces_.emplace("__gnu_cxx");
- blink_directories_.emplace("/third_party/WebKit/");
-
banned_directories_.emplace("/third_party/");
banned_directories_.emplace("/native_client/");
banned_directories_.emplace("/breakpad/");
« no previous file with comments | « tools/clang/plugins/ChromeClassTester.h ('k') | tools/clang/plugins/FindBadConstructsConsumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698