| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "Config.h" | 5 #include "Config.h" |
| 6 #include "RecordInfo.h" | 6 #include "RecordInfo.h" |
| 7 | 7 |
| 8 using namespace clang; | 8 using namespace clang; |
| 9 using std::string; | 9 using std::string; |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (it->size() < 2) continue; | 127 if (it->size() < 2) continue; |
| 128 const CXXBasePathElement& elem = (*it)[it->size() - 2]; | 128 const CXXBasePathElement& elem = (*it)[it->size() - 2]; |
| 129 CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl(); | 129 CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl(); |
| 130 if (Config::IsTreeSharedBase(base->getName())) | 130 if (Config::IsTreeSharedBase(base->getName())) |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 // A GC mixin is a class that inherits from a GC mixin base and has | 136 // A GC mixin is a class that inherits from a GC mixin base and has |
| 137 // has not yet been "mixed in" with another GC base class. | 137 // not yet been "mixed in" with another GC base class. |
| 138 bool RecordInfo::IsGCMixin() { | 138 bool RecordInfo::IsGCMixin() { |
| 139 if (!IsGCDerived() || base_paths_->begin() == base_paths_->end()) | 139 if (!IsGCDerived() || base_paths_->begin() == base_paths_->end()) |
| 140 return false; | 140 return false; |
| 141 // Get the last element of the first path. | 141 for (CXXBasePaths::paths_iterator it = base_paths_->begin(); |
| 142 CXXBasePaths::paths_iterator it = base_paths_->begin(); | 142 it != base_paths_->end(); |
| 143 const CXXBasePathElement& elem = (*it)[it->size() - 1]; | 143 ++it) { |
| 144 CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl(); | 144 // Get the last element of the path. |
| 145 // If it is not a mixin base we are done. | 145 const CXXBasePathElement& elem = (*it)[it->size() - 1]; |
| 146 if (!Config::IsGCMixinBase(base->getName())) | 146 CXXRecordDecl* base = elem.Base->getType()->getAsCXXRecordDecl(); |
| 147 return false; | 147 // If it is not a mixin base we are done. |
| 148 // This is a mixin if there are no other paths to GC bases. | 148 if (!Config::IsGCMixinBase(base->getName())) |
| 149 return ++it == base_paths_->end(); | 149 return false; |
| 150 } |
| 151 // This is a mixin if all GC bases are mixins. |
| 152 return true; |
| 150 } | 153 } |
| 151 | 154 |
| 152 // Test if a record is allocated on the managed heap. | 155 // Test if a record is allocated on the managed heap. |
| 153 bool RecordInfo::IsGCAllocated() { | 156 bool RecordInfo::IsGCAllocated() { |
| 154 return IsGCDerived() || IsHeapAllocatedCollection(); | 157 return IsGCDerived() || IsHeapAllocatedCollection(); |
| 155 } | 158 } |
| 156 | 159 |
| 157 RecordInfo* RecordCache::Lookup(CXXRecordDecl* record) { | 160 RecordInfo* RecordCache::Lookup(CXXRecordDecl* record) { |
| 158 // Ignore classes annotated with the GC_PLUGIN_IGNORE macro. | 161 // Ignore classes annotated with the GC_PLUGIN_IGNORE macro. |
| 159 if (!record || Config::IsIgnoreAnnotated(record)) | 162 if (!record || Config::IsIgnoreAnnotated(record)) |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 // We failed to create an edge so abort the entire edge construction. | 508 // We failed to create an edge so abort the entire edge construction. |
| 506 delete edge; // Will delete the already allocated members. | 509 delete edge; // Will delete the already allocated members. |
| 507 return 0; | 510 return 0; |
| 508 } | 511 } |
| 509 } | 512 } |
| 510 return edge; | 513 return edge; |
| 511 } | 514 } |
| 512 | 515 |
| 513 return new Value(info); | 516 return new Value(info); |
| 514 } | 517 } |
| OLD | NEW |