bool RecordInfo::IsTreeShared() { if (Config::IsTreeSharedBase(name_)) return true; if (!IsGCDerived()) return false; for (CXXBasePaths::paths_iterator it = base_paths_->begin(); it != base_paths_->end(); ++it) { // TreeShared is an immediate base of GCFinalized. if (it->size() < 2) continue; const CXXBasePathElement& elem = (*it)[it->size() - 2]; CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl(); if (Config::IsTreeSharedBase(base->getName())) return true; } return false; }
// 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. 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(); }
bool RecordInfo::IsGCFinalized() { if (!IsGCDerived()) return false; for (CXXBasePaths::paths_iterator it = base_paths_->begin(); it != base_paths_->end(); ++it) { const CXXBasePathElement& elem = (*it)[it->size() - 1]; CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl(); if (Config::IsGCFinalizedBase(base->getName())) return true; } return false; }