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

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

Issue 150943005: Add a check to the FindBadConstructs.cpp clang plugin for bad enum last values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 500s Created 6 years, 10 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/FindBadConstructs.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 7336cc859e22b40ee4ffac188c4b519d5fc2e548..94e89f7a02d1812e05190fecc0359d3f3d05ad4e 100644
--- a/tools/clang/plugins/ChromeClassTester.cpp
+++ b/tools/clang/plugins/ChromeClassTester.cpp
@@ -93,6 +93,16 @@ void ChromeClassTester::CheckTag(TagDecl* tag) {
return;
CheckChromeClass(record_location, record);
+ } else if (EnumDecl* enum_decl = dyn_cast<EnumDecl>(tag)) {
+ SourceLocation enum_location = enum_decl->getInnerLocStart();
+ if (InBannedDirectory(enum_location))
+ return;
+
+ std::string base_name = enum_decl->getNameAsString();
+ if (IsIgnoredType(base_name))
+ return;
+
+ CheckChromeEnum(enum_location, enum_decl);
}
}
@@ -200,6 +210,9 @@ void ChromeClassTester::BuildBannedLists() {
// non-pod class member. Probably harmless.
ignored_record_names_.insert("MockTransaction");
+ // Enum type with _LAST members where _LAST doesn't mean last enum value.
+ ignored_record_names_.insert("ServerFieldType");
+
// Used heavily in ui_unittests and once in views_unittests. Fixing this
// isn't worth the overhead of an additional library.
ignored_record_names_.insert("TestAnimationDelegate");
@@ -211,6 +224,9 @@ void ChromeClassTester::BuildBannedLists() {
// Measured performance improvement on cc_perftests. See
// https://codereview.chromium.org/11299290/
ignored_record_names_.insert("QuadF");
+
+ // Enum type with _LAST members where _LAST doesn't mean last enum value.
+ ignored_record_names_.insert("ViewID");
}
std::string ChromeClassTester::GetNamespaceImpl(const DeclContext* context,
« no previous file with comments | « tools/clang/plugins/ChromeClassTester.h ('k') | tools/clang/plugins/FindBadConstructs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698