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

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

Issue 260073010: Fix IsGCMixin predicate to correctly identify classes with multiple mixin bases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | 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 fb3c4a2464c06ed786859f074e9b61949cf33a71..bbe4e58e11f918e406eae055f2da8085a1258c55 100644
--- a/tools/clang/blink_gc_plugin/RecordInfo.cpp
+++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -134,19 +134,22 @@ bool RecordInfo::IsTreeShared() {
}
// A GC mixin is a class that inherits from a GC mixin base and has
-// has not yet been "mixed in" with another GC base class.
+// not yet been "mixed in" with another GC base class.
bool RecordInfo::IsGCMixin() {
if (!IsGCDerived() || base_paths_->begin() == base_paths_->end())
return false;
- // Get the last element of the first path.
- CXXBasePaths::paths_iterator it = base_paths_->begin();
- const CXXBasePathElement& elem = (*it)[it->size() - 1];
- CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl();
- // If it is not a mixin base we are done.
- if (!Config::IsGCMixinBase(base->getName()))
- return false;
- // This is a mixin if there are no other paths to GC bases.
- return ++it == base_paths_->end();
+ for (CXXBasePaths::paths_iterator it = base_paths_->begin();
+ it != base_paths_->end();
+ ++it) {
+ // Get the last element of the path.
+ const CXXBasePathElement& elem = (*it)[it->size() - 1];
+ CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl();
+ // If it is not a mixin base we are done.
+ if (!Config::IsGCMixinBase(base->getName()))
+ return false;
+ }
+ // This is a mixin if all GC bases are mixins.
+ return true;
}
// Test if a record is allocated on the managed heap.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698