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 // 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 bool IsNonNewable(); | 93 bool IsNonNewable(); |
94 bool IsOnlyPlacementNewable(); | 94 bool IsOnlyPlacementNewable(); |
95 clang::CXXMethodDecl* DeclaresNewOperator(); | 95 clang::CXXMethodDecl* DeclaresNewOperator(); |
96 | 96 |
97 bool RequiresTraceMethod(); | 97 bool RequiresTraceMethod(); |
98 bool NeedsFinalization(); | 98 bool NeedsFinalization(); |
99 TracingStatus NeedsTracing(Edge::NeedsTracingOption); | 99 TracingStatus NeedsTracing(Edge::NeedsTracingOption); |
100 clang::CXXMethodDecl* InheritsNonVirtualTrace(); | 100 clang::CXXMethodDecl* InheritsNonVirtualTrace(); |
101 bool IsConsideredAbstract(); | 101 bool IsConsideredAbstract(); |
102 | 102 |
| 103 static clang::CXXRecordDecl* GetDependentTemplatedDecl(const clang::Type&); |
| 104 |
103 private: | 105 private: |
104 RecordInfo(clang::CXXRecordDecl* record, RecordCache* cache); | 106 RecordInfo(clang::CXXRecordDecl* record, RecordCache* cache); |
105 | 107 |
| 108 void walkBases(); |
| 109 |
106 Fields* CollectFields(); | 110 Fields* CollectFields(); |
107 Bases* CollectBases(); | 111 Bases* CollectBases(); |
108 void DetermineTracingMethods(); | 112 void DetermineTracingMethods(); |
109 bool InheritsTrace(); | 113 bool InheritsTrace(); |
110 | 114 |
111 Edge* CreateEdge(const clang::Type* type); | 115 Edge* CreateEdge(const clang::Type* type); |
112 | 116 |
113 RecordCache* cache_; | 117 RecordCache* cache_; |
114 clang::CXXRecordDecl* record_; | 118 clang::CXXRecordDecl* record_; |
115 const std::string name_; | 119 const std::string name_; |
116 TracingStatus fields_need_tracing_; | 120 TracingStatus fields_need_tracing_; |
117 Bases* bases_; | 121 Bases* bases_; |
118 Fields* fields_; | 122 Fields* fields_; |
119 | 123 |
120 enum CachedBool { kFalse = 0, kTrue = 1, kNotComputed = 2 }; | 124 enum CachedBool { kFalse = 0, kTrue = 1, kNotComputed = 2 }; |
121 CachedBool is_stack_allocated_; | 125 CachedBool is_stack_allocated_; |
122 CachedBool is_non_newable_; | 126 CachedBool is_non_newable_; |
123 CachedBool is_only_placement_newable_; | 127 CachedBool is_only_placement_newable_; |
124 CachedBool does_need_finalization_; | 128 CachedBool does_need_finalization_; |
125 | 129 |
126 bool determined_trace_methods_; | 130 bool determined_trace_methods_; |
127 clang::CXXMethodDecl* trace_method_; | 131 clang::CXXMethodDecl* trace_method_; |
128 clang::CXXMethodDecl* trace_dispatch_method_; | 132 clang::CXXMethodDecl* trace_dispatch_method_; |
129 clang::CXXMethodDecl* finalize_dispatch_method_; | 133 clang::CXXMethodDecl* finalize_dispatch_method_; |
130 | 134 |
131 bool is_gc_derived_; | 135 bool is_gc_derived_; |
132 clang::CXXBasePaths* base_paths_; | 136 |
| 137 std::vector<std::string> gc_base_names_; |
133 | 138 |
134 friend class RecordCache; | 139 friend class RecordCache; |
135 }; | 140 }; |
136 | 141 |
137 class RecordCache { | 142 class RecordCache { |
138 public: | 143 public: |
139 RecordInfo* Lookup(clang::CXXRecordDecl* record); | 144 RecordInfo* Lookup(clang::CXXRecordDecl* record); |
140 | 145 |
141 RecordInfo* Lookup(const clang::CXXRecordDecl* record) { | 146 RecordInfo* Lookup(const clang::CXXRecordDecl* record) { |
142 return Lookup(const_cast<clang::CXXRecordDecl*>(record)); | 147 return Lookup(const_cast<clang::CXXRecordDecl*>(record)); |
(...skipping 22 matching lines...) Expand all Loading... |
165 } | 170 } |
166 } | 171 } |
167 } | 172 } |
168 | 173 |
169 private: | 174 private: |
170 typedef std::map<clang::CXXRecordDecl*, RecordInfo> Cache; | 175 typedef std::map<clang::CXXRecordDecl*, RecordInfo> Cache; |
171 Cache cache_; | 176 Cache cache_; |
172 }; | 177 }; |
173 | 178 |
174 #endif // TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_ | 179 #endif // TOOLS_BLINK_GC_PLUGIN_RECORD_INFO_H_ |
OLD | NEW |