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

Unified Diff: tools/clang/blink_gc_plugin/RecordInfo.cpp

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 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/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/heap/stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/blink_gc_plugin/RecordInfo.cpp
diff --git a/tools/clang/blink_gc_plugin/RecordInfo.cpp b/tools/clang/blink_gc_plugin/RecordInfo.cpp
index 025741519cb8e1946c3379dcaa378efb30d450aa..bda33fa992fb5cd92a907fcbb8d9b1c18c94a61b 100644
--- a/tools/clang/blink_gc_plugin/RecordInfo.cpp
+++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -427,39 +427,50 @@ void RecordInfo::DetermineTracingMethods() {
if (Config::IsGCBase(name_))
return;
CXXMethodDecl* trace = nullptr;
+ CXXMethodDecl* trace_impl = nullptr;
CXXMethodDecl* trace_after_dispatch = nullptr;
bool has_adjust_and_mark = false;
bool has_is_heap_object_alive = false;
- for (CXXRecordDecl::method_iterator it = record_->method_begin();
- it != record_->method_end();
- ++it) {
- switch (Config::GetTraceMethodType(*it)) {
+ for (Decl* decl : record_->decls()) {
+ CXXMethodDecl* method = dyn_cast<CXXMethodDecl>(decl);
+ if (!method) {
+ if (FunctionTemplateDecl* func_template =
+ dyn_cast<FunctionTemplateDecl>(decl))
+ method = dyn_cast<CXXMethodDecl>(func_template->getTemplatedDecl());
+ }
+ if (!method)
+ continue;
+
+ switch (Config::GetTraceMethodType(method)) {
case Config::TRACE_METHOD:
- trace = *it;
+ trace = method;
break;
case Config::TRACE_AFTER_DISPATCH_METHOD:
- trace_after_dispatch = *it;
+ trace_after_dispatch = method;
break;
case Config::TRACE_IMPL_METHOD:
+ trace_impl = method;
+ break;
case Config::TRACE_AFTER_DISPATCH_IMPL_METHOD:
break;
case Config::NOT_TRACE_METHOD:
- if (it->getNameAsString() == kFinalizeName) {
- finalize_dispatch_method_ = *it;
- } else if (it->getNameAsString() == kAdjustAndMarkName) {
+ if (method->getNameAsString() == kFinalizeName) {
+ finalize_dispatch_method_ = method;
+ } else if (method->getNameAsString() == kAdjustAndMarkName) {
has_adjust_and_mark = true;
- } else if (it->getNameAsString() == kIsHeapObjectAliveName) {
+ } else if (method->getNameAsString() == kIsHeapObjectAliveName) {
has_is_heap_object_alive = true;
}
break;
}
}
+
// Record if class defines the two GCMixin methods.
has_gc_mixin_methods_ =
has_adjust_and_mark && has_is_heap_object_alive ? kTrue : kFalse;
if (trace_after_dispatch) {
trace_method_ = trace_after_dispatch;
- trace_dispatch_method_ = trace;
+ trace_dispatch_method_ = trace_impl ? trace_impl : trace;
} else {
// TODO: Can we never have a dispatch method called trace without the same
// class defining a traceAfterDispatch method?
« no previous file with comments | « tools/clang/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/heap/stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698