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

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

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 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/FindBadConstructsConsumer.h ('k') | tools/clang/plugins/Options.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « tools/clang/plugins/FindBadConstructsConsumer.h ('k') | tools/clang/plugins/Options.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698