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

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

Issue 212673008: Revert of 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: Created 6 years, 9 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.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/plugins/FindBadConstructs.cpp
diff --git a/tools/clang/plugins/FindBadConstructs.cpp b/tools/clang/plugins/FindBadConstructs.cpp
index b9f83db91fd5d5debbc562a66bf6bd82b9ebc69a..c8d166e38dbf53a986b24e2e3c1f5562637b8acd 100644
--- a/tools/clang/plugins/FindBadConstructs.cpp
+++ b/tools/clang/plugins/FindBadConstructs.cpp
@@ -14,8 +14,6 @@
// should have protected or private destructors.
// - WeakPtrFactory members that refer to their outer class should be the last
// member.
-// - Enum types with a xxxx_LAST or xxxxLast const actually have that constant
-// have the maximal value for that type.
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/AST.h"
@@ -50,9 +48,6 @@
const char kWeakPtrFactoryOrder[] =
"[chromium-style] WeakPtrFactory members which refer to their outer class "
"must be the last member in the outer class definition.";
-const char kBadLastEnumValue[] =
- "[chromium-style] _LAST/Last constants of enum types must have the maximal "
- "value for any constant of that type.";
const char kNoteInheritance[] =
"[chromium-style] %0 inherits from %1 here";
const char kNoteImplicitDtor[] =
@@ -112,8 +107,6 @@
getErrorLevel(), kProtectedNonVirtualDtor);
diag_weak_ptr_factory_order_ = diagnostic().getCustomDiagID(
getErrorLevel(), kWeakPtrFactoryOrder);
- diag_bad_enum_last_value_ = diagnostic().getCustomDiagID(
- getErrorLevel(), kBadLastEnumValue);
// Registers notes to make it easier to interpret warnings.
diag_note_inheritance_ = diagnostic().getCustomDiagID(
@@ -150,32 +143,6 @@
CheckWeakPtrFactoryMembers(record_location, record);
}
- virtual void CheckChromeEnum(SourceLocation enum_location,
- EnumDecl* enum_decl) {
- bool got_one = false;
- llvm::APSInt max_so_far;
- EnumDecl::enumerator_iterator iter;
- for (iter = enum_decl->enumerator_begin();
- iter != enum_decl->enumerator_end(); ++iter) {
- if (!got_one) {
- max_so_far = iter->getInitVal();
- got_one = true;
- } else if (iter->getInitVal() > max_so_far)
- max_so_far = iter->getInitVal();
- }
- for (iter = enum_decl->enumerator_begin();
- iter != enum_decl->enumerator_end(); ++iter) {
- std::string name = iter->getNameAsString();
- if (((name.size() > 4 &&
- name.compare(name.size() - 4, 4, "Last") == 0) ||
- (name.size() > 5 &&
- name.compare(name.size() - 5, 5, "_LAST") == 0)) &&
- iter->getInitVal() < max_so_far) {
- diagnostic().Report(iter->getLocation(), diag_bad_enum_last_value_);
- }
- }
- }
-
private:
// The type of problematic ref-counting pattern that was encountered.
enum RefcountIssue {
@@ -192,7 +159,6 @@
unsigned diag_public_dtor_;
unsigned diag_protected_non_virtual_dtor_;
unsigned diag_weak_ptr_factory_order_;
- unsigned diag_bad_enum_last_value_;
unsigned diag_note_inheritance_;
unsigned diag_note_implicit_dtor_;
unsigned diag_note_public_dtor_;
« no previous file with comments | « tools/clang/plugins/ChromeClassTester.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698