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

Side by Side Diff: tools/clang/blink_gc_plugin/RecordInfo.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/clang/blink_gc_plugin/Edge.cpp ('k') | tools/clang/blink_gc_plugin/RecordInfo.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file provides a wrapper for CXXRecordDecl that accumulates GC related 5 // This file provides a wrapper for CXXRecordDecl that accumulates GC related
6 // information about a class. Accumulated information is memoized and the info 6 // information about a class. Accumulated information is memoized and the info
7 // objects are stored in a RecordCache. 7 // objects are stored in a RecordCache.
8 8
9 #ifndef TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_ 9 #ifndef TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_
10 #define TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_ 10 #define TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_
(...skipping 14 matching lines...) Expand all
25 GraphPoint() : traced_(false) {} 25 GraphPoint() : traced_(false) {}
26 void MarkTraced() { traced_ = true; } 26 void MarkTraced() { traced_ = true; }
27 bool IsProperlyTraced() { return traced_ || !NeedsTracing().IsNeeded(); } 27 bool IsProperlyTraced() { return traced_ || !NeedsTracing().IsNeeded(); }
28 virtual const TracingStatus NeedsTracing() = 0; 28 virtual const TracingStatus NeedsTracing() = 0;
29 private: 29 private:
30 bool traced_; 30 bool traced_;
31 }; 31 };
32 32
33 class BasePoint : public GraphPoint { 33 class BasePoint : public GraphPoint {
34 public: 34 public:
35 BasePoint(RecordInfo* info, const TracingStatus& status) 35 BasePoint(const clang::CXXBaseSpecifier& spec,
36 : info_(info), status_(status) {} 36 RecordInfo* info,
37 RecordInfo* info() { return info_; } 37 const TracingStatus& status)
38 : spec_(spec), info_(info), status_(status) {}
38 const TracingStatus NeedsTracing() { return status_; } 39 const TracingStatus NeedsTracing() { return status_; }
39 // Needed to change the status of bases with a pure-virtual trace. 40 // Needed to change the status of bases with a pure-virtual trace.
40 void MarkUnneeded() { status_ = TracingStatus::Unneeded(); } 41 void MarkUnneeded() { status_ = TracingStatus::Unneeded(); }
42 const clang::CXXBaseSpecifier& spec() { return spec_; }
43 RecordInfo* info() { return info_; }
41 private: 44 private:
45 const clang::CXXBaseSpecifier& spec_;
42 RecordInfo* info_; 46 RecordInfo* info_;
43 TracingStatus status_; 47 TracingStatus status_;
44 }; 48 };
45 49
46 class FieldPoint : public GraphPoint { 50 class FieldPoint : public GraphPoint {
47 public: 51 public:
48 FieldPoint(clang::FieldDecl* field, Edge* edge) : field_(field), edge_(edge) { 52 FieldPoint(clang::FieldDecl* field, Edge* edge) : field_(field), edge_(edge) {
49 assert(edge && "FieldPoint edge must be non-null"); 53 assert(edge && "FieldPoint edge must be non-null");
50 } 54 }
51 const TracingStatus NeedsTracing() { 55 const TracingStatus NeedsTracing() {
(...skipping 26 matching lines...) Expand all
78 82
79 bool GetTemplateArgs(size_t count, TemplateArgs* output_args); 83 bool GetTemplateArgs(size_t count, TemplateArgs* output_args);
80 84
81 bool IsHeapAllocatedCollection(); 85 bool IsHeapAllocatedCollection();
82 bool IsGCDerived(); 86 bool IsGCDerived();
83 bool IsGCAllocated(); 87 bool IsGCAllocated();
84 bool IsGCFinalized(); 88 bool IsGCFinalized();
85 89
86 bool IsStackAllocated(); 90 bool IsStackAllocated();
87 bool RequiresTraceMethod(); 91 bool RequiresTraceMethod();
92 bool NeedsFinalization();
88 TracingStatus NeedsTracing(Edge::NeedsTracingOption); 93 TracingStatus NeedsTracing(Edge::NeedsTracingOption);
89 94
90 private: 95 private:
91 RecordInfo(clang::CXXRecordDecl* record, RecordCache* cache); 96 RecordInfo(clang::CXXRecordDecl* record, RecordCache* cache);
92 97
93 Fields* CollectFields(); 98 Fields* CollectFields();
94 Bases* CollectBases(); 99 Bases* CollectBases();
95 void DetermineTracingMethods(); 100 void DetermineTracingMethods();
96 bool InheritsNonPureTrace(); 101 bool InheritsNonPureTrace();
97 102
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 150 }
146 } 151 }
147 } 152 }
148 153
149 private: 154 private:
150 typedef std::map<clang::CXXRecordDecl*, RecordInfo> Cache; 155 typedef std::map<clang::CXXRecordDecl*, RecordInfo> Cache;
151 Cache cache_; 156 Cache cache_;
152 }; 157 };
153 158
154 #endif // TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_ 159 #endif // TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/Edge.cpp ('k') | tools/clang/blink_gc_plugin/RecordInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698