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

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

Issue 1433883003: GC plugin: RefPtr<T> is legal if T is RefCountedGC-derived. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 defines the names used by GC infrastructure. 5 // This file defines the names used by GC infrastructure.
6 6
7 // TODO: Restructure the name determination to use fully qualified names (ala, 7 // TODO: Restructure the name determination to use fully qualified names (ala,
8 // blink::Foo) so that the plugin can be enabled for all of chromium. Doing so 8 // blink::Foo) so that the plugin can be enabled for all of chromium. Doing so
9 // would allow us to catch errors with structures outside of blink that might 9 // would allow us to catch errors with structures outside of blink that might
10 // have unsafe pointers to GC allocated blink structures. 10 // have unsafe pointers to GC allocated blink structures.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 static bool IsGCMixinBase(const std::string& name) { 131 static bool IsGCMixinBase(const std::string& name) {
132 return name == "GarbageCollectedMixin"; 132 return name == "GarbageCollectedMixin";
133 } 133 }
134 134
135 static bool IsGCFinalizedBase(const std::string& name) { 135 static bool IsGCFinalizedBase(const std::string& name) {
136 return name == "GarbageCollectedFinalized" || 136 return name == "GarbageCollectedFinalized" ||
137 name == "RefCountedGarbageCollected" || 137 name == "RefCountedGarbageCollected" ||
138 name == "ThreadSafeRefCountedGarbageCollected"; 138 name == "ThreadSafeRefCountedGarbageCollected";
139 } 139 }
140 140
141 static bool IsGCRefCountedBase(const std::string& name) {
142 return name == "RefCountedGarbageCollected" ||
143 name == "ThreadSafeRefCountedGarbageCollected";
144 }
145
141 static bool IsGCBase(const std::string& name) { 146 static bool IsGCBase(const std::string& name) {
142 return name == "GarbageCollected" || 147 return name == "GarbageCollected" ||
143 IsGCFinalizedBase(name) || 148 IsGCFinalizedBase(name) ||
144 IsGCMixinBase(name); 149 IsGCMixinBase(name);
145 } 150 }
146 151
147 // Returns true of the base classes that do not need a vtable entry for trace 152 // Returns true of the base classes that do not need a vtable entry for trace
148 // because they cannot possibly initiate a GC during construction. 153 // because they cannot possibly initiate a GC during construction.
149 static bool IsSafePolymorphicBase(const std::string& name) { 154 static bool IsSafePolymorphicBase(const std::string& name) {
150 return IsGCBase(name) || IsDummyBase(name) || IsRefCountedBase(name); 155 return IsGCBase(name) || IsDummyBase(name) || IsRefCountedBase(name);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 if (suffix.size() > str.size()) 268 if (suffix.size() > str.size())
264 return false; 269 return false;
265 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; 270 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
266 } 271 }
267 272
268 // Test if a template specialization is an instantiation. 273 // Test if a template specialization is an instantiation.
269 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record); 274 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record);
270 }; 275 };
271 276
272 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 277 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp ('k') | tools/clang/blink_gc_plugin/RecordInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698