summaryrefslogtreecommitdiffstats
path: root/tools/clang
diff options
context:
space:
mode:
authorzerny@chromium.org <zerny@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-29 11:31:59 +0000
committerzerny@chromium.org <zerny@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-29 11:31:59 +0000
commitdb4d24fdaf4a32bcc3a213eb980696956f58e22a (patch)
treecff604c276a4b849664a25ff2fb8d8e3dae6d90f /tools/clang
parentffdb1d5f1209b63962bd4ba88114e00c2400078b (diff)
downloadchromium_src-db4d24fdaf4a32bcc3a213eb980696956f58e22a.zip
chromium_src-db4d24fdaf4a32bcc3a213eb980696956f58e22a.tar.gz
chromium_src-db4d24fdaf4a32bcc3a213eb980696956f58e22a.tar.bz2
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
Diffstat (limited to 'tools/clang')
-rw-r--r--tools/clang/blink_gc_plugin/RecordInfo.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/tools/clang/blink_gc_plugin/RecordInfo.cpp b/tools/clang/blink_gc_plugin/RecordInfo.cpp
index fb3c4a2..bbe4e58 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.