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

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

Issue 827693004: Blink GC plugin: improve handling of type dependent bases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « no previous file | tools/clang/blink_gc_plugin/RecordInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
diff --git a/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
index d24d67ade4ff4c37aa2016b8d4d76567ea422652..c9db205dee577a79acb5dee89ce6b8d2355071df 100644
--- a/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
+++ b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
@@ -400,16 +400,7 @@ class CheckTraceVisitor : public RecursiveASTVisitor<CheckTraceVisitor> {
if (!type)
return 0;
- const TemplateSpecializationType* tmpl_type =
- type->getAs<TemplateSpecializationType>();
- if (!tmpl_type)
- return 0;
-
- TemplateDecl* tmpl_decl = tmpl_type->getTemplateName().getAsTemplateDecl();
- if (!tmpl_decl)
- return 0;
-
- return dyn_cast<CXXRecordDecl>(tmpl_decl->getTemplatedDecl());
+ return RecordInfo::GetDependentTemplatedDecl(*type);
}
void CheckCXXDependentScopeMemberExpr(CallExpr* call,
@@ -1042,7 +1033,7 @@ class BlinkGCPluginConsumer : public ASTConsumer {
while (it != left_most->bases_end()) {
left_most_base = it->getType()->getAsCXXRecordDecl();
if (!left_most_base && it->getType()->isDependentType())
- left_most_base = GetDependentTemplatedDecl(*it->getType());
+ left_most_base = RecordInfo::GetDependentTemplatedDecl(*it->getType());
// TODO: Find a way to correctly check actual instantiations
// for dependent types. The escape below will be hit, eg, when
@@ -1103,7 +1094,7 @@ class BlinkGCPluginConsumer : public ASTConsumer {
CXXRecordDecl::base_class_iterator it = left_most->bases_begin();
while (it != left_most->bases_end()) {
if (it->getType()->isDependentType())
- left_most = GetDependentTemplatedDecl(*it->getType());
+ left_most = RecordInfo::GetDependentTemplatedDecl(*it->getType());
else
left_most = it->getType()->getAsCXXRecordDecl();
if (!left_most || !left_most->hasDefinition())
@@ -1122,12 +1113,9 @@ class BlinkGCPluginConsumer : public ASTConsumer {
}
void CheckLeftMostDerived(RecordInfo* info) {
- CXXRecordDecl* left_most = info->record();
- CXXRecordDecl::base_class_iterator it = left_most->bases_begin();
- while (it != left_most->bases_end()) {
- left_most = it->getType()->getAsCXXRecordDecl();
- it = left_most->bases_begin();
- }
+ CXXRecordDecl* left_most = GetLeftMostBase(info->record());
+ if (!left_most)
+ return;
if (!Config::IsGCBase(left_most->getName()))
ReportClassMustLeftMostlyDeriveGC(info);
}
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/RecordInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698