Commit db4d24fd authored by zerny@chromium.org's avatar zerny@chromium.org

Fix IsGCMixin predicate to correctly identify classes with multiple mixin bases.

R=ager@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/260073010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266851 0039d316-1c4b-4281-b951-d872f2087c98
parent ffdb1d5f
...@@ -134,19 +134,22 @@ bool RecordInfo::IsTreeShared() { ...@@ -134,19 +134,22 @@ bool RecordInfo::IsTreeShared() {
} }
// A GC mixin is a class that inherits from a GC mixin base and has // 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() { bool RecordInfo::IsGCMixin() {
if (!IsGCDerived() || base_paths_->begin() == base_paths_->end()) if (!IsGCDerived() || base_paths_->begin() == base_paths_->end())
return false; return false;
// Get the last element of the first path. for (CXXBasePaths::paths_iterator it = base_paths_->begin();
CXXBasePaths::paths_iterator it = base_paths_->begin(); it != base_paths_->end();
const CXXBasePathElement& elem = (*it)[it->size() - 1]; ++it) {
CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl(); // Get the last element of the path.
// If it is not a mixin base we are done. const CXXBasePathElement& elem = (*it)[it->size() - 1];
if (!Config::IsGCMixinBase(base->getName())) CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl();
return false; // If it is not a mixin base we are done.
// This is a mixin if there are no other paths to GC bases. if (!Config::IsGCMixinBase(base->getName()))
return ++it == base_paths_->end(); return false;
}
// This is a mixin if all GC bases are mixins.
return true;
} }
// Test if a record is allocated on the managed heap. // Test if a record is allocated on the managed heap.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment