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

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

Issue 192933002: Check that classes with non-trivial destructors have finalization support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments and rebase Created 6 years, 9 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
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 2fa8d5363b92a3ebb30f301121e186615ca209fb..f8ec02527e37749d61798e77d41bf659ab24c492 100644
--- a/tools/clang/blink_gc_plugin/RecordInfo.cpp
+++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -174,12 +174,13 @@ RecordInfo::Bases* RecordInfo::CollectBases() {
for (CXXRecordDecl::base_class_iterator it = record_->bases_begin();
it != record_->bases_end();
++it) {
- if (CXXRecordDecl* base = it->getType()->getAsCXXRecordDecl()) {
+ const CXXBaseSpecifier& spec = *it;
+ if (CXXRecordDecl* base = spec.getType()->getAsCXXRecordDecl()) {
RecordInfo* info = cache_->Lookup(base);
TracingStatus status = info->InheritsNonPureTrace()
? TracingStatus::Needed()
: TracingStatus::Unneeded();
- bases->insert(std::make_pair(base, BasePoint(info, status)));
+ bases->insert(std::make_pair(base, BasePoint(spec, info, status)));
}
}
return bases;
@@ -241,6 +242,11 @@ void RecordInfo::DetermineTracingMethods() {
}
}
+// TODO: Add classes with a finalize() method that specialize FinalizerTrait.
+bool RecordInfo::NeedsFinalization() {
+ return record_->hasNonTrivialDestructor();
+}
+
// A class needs tracing if:
// - it is allocated on the managed heap,
// - it defines a trace method (of the proper signature), or
@@ -328,7 +334,7 @@ Edge* RecordInfo::CreateEdge(const Type* type) {
size_t count = Config::CollectionDimension(info->name());
if (!info->GetTemplateArgs(count, &args))
return 0;
- Collection* edge = new Collection(on_heap, is_root);
+ Collection* edge = new Collection(info, on_heap, is_root);
for (TemplateArgs::iterator it = args.begin(); it != args.end(); ++it) {
if (Edge* member = CreateEdge(*it)) {
edge->members().push_back(member);
« no previous file with comments | « tools/clang/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/class_requires_finalization_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698