Index: tools/clang/plugins/FindBadConstructsConsumer.cpp |
diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp |
index 83a18b0206f7d1ac6371a5fead21a7ba05f91aa9..c99c389879270d6e0283e0c2c5c503218c77b52f 100644 |
--- a/tools/clang/plugins/FindBadConstructsConsumer.cpp |
+++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp |
@@ -619,6 +619,7 @@ void FindBadConstructsConsumer::CountType(const Type* type, |
// a type that is. |
// If there are issues, update |loc| with the SourceLocation of the issue |
// and returns appropriately, or returns None if there are no issues. |
+// static |
FindBadConstructsConsumer::RefcountIssue |
FindBadConstructsConsumer::CheckRecordForRefcountIssue( |
const CXXRecordDecl* record, |
@@ -640,13 +641,10 @@ FindBadConstructsConsumer::CheckRecordForRefcountIssue( |
// Returns true if |base| specifies one of the Chromium reference counted |
// classes (base::RefCounted / base::RefCountedThreadSafe). |
-bool FindBadConstructsConsumer::IsRefCountedCallback( |
+bool FindBadConstructsConsumer::IsRefCounted( |
const CXXBaseSpecifier* base, |
- CXXBasePath& path, |
- void* user_data) { |
- FindBadConstructsConsumer* self = |
- static_cast<FindBadConstructsConsumer*>(user_data); |
- |
+ CXXBasePath& path) { |
+ FindBadConstructsConsumer* self = this; |
const TemplateSpecializationType* base_type = |
dyn_cast<TemplateSpecializationType>( |
UnwrapType(base->getType().getTypePtr())); |
@@ -674,6 +672,7 @@ bool FindBadConstructsConsumer::IsRefCountedCallback( |
// Returns true if |base| specifies a class that has a public destructor, |
// either explicitly or implicitly. |
+// static |
bool FindBadConstructsConsumer::HasPublicDtorCallback( |
const CXXBaseSpecifier* base, |
CXXBasePath& path, |
@@ -731,9 +730,11 @@ void FindBadConstructsConsumer::CheckRefCountedDtors( |
// Determine if the current type is even ref-counted. |
CXXBasePaths refcounted_path; |
- if (!record->lookupInBases(&FindBadConstructsConsumer::IsRefCountedCallback, |
- this, |
- refcounted_path)) { |
+ if (!record->lookupInBases( |
+ [this](const CXXBaseSpecifier* base, CXXBasePath& path) { |
+ return IsRefCounted(base, path); |
+ }, |
+ refcounted_path)) { |
return; // Class does not derive from a ref-counted base class. |
} |
@@ -783,9 +784,12 @@ void FindBadConstructsConsumer::CheckRefCountedDtors( |
// Find all public destructors. This will record the class hierarchy |
// that leads to the public destructor in |dtor_paths|. |
CXXBasePaths dtor_paths; |
- if (!record->lookupInBases(&FindBadConstructsConsumer::HasPublicDtorCallback, |
- this, |
- dtor_paths)) { |
+ if (!record->lookupInBases( |
+ [](const CXXBaseSpecifier* base, CXXBasePath& path) { |
+ // TODO(thakis): Inline HasPublicDtorCallback() after clang roll. |
+ return HasPublicDtorCallback(base, path, nullptr); |
+ }, |
+ dtor_paths)) { |
return; |
} |