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

Side by Side Diff: tools/clang/blink_gc_plugin/Config.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/BlinkGCPlugin.cpp ('k') | tools/clang/blink_gc_plugin/Edge.h » ('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 defines the names used by GC infrastructure. 5 // This file defines the names used by GC infrastructure.
6 6
7 #ifndef TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 7 #ifndef TOOLS_BLINK_GC_PLUGIN_CONFIG_H_
8 #define TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 8 #define TOOLS_BLINK_GC_PLUGIN_CONFIG_H_
9 9
10 #include "clang/AST/AST.h" 10 #include "clang/AST/AST.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 name == "PersistentHeapHashSet"; 66 name == "PersistentHeapHashSet";
67 } 67 }
68 68
69 static bool IsGCCollection(const std::string& name) { 69 static bool IsGCCollection(const std::string& name) {
70 return name == "HeapVector" || 70 return name == "HeapVector" ||
71 name == "HeapHashMap" || 71 name == "HeapHashMap" ||
72 name == "HeapHashSet" || 72 name == "HeapHashSet" ||
73 IsPersistentGCCollection(name); 73 IsPersistentGCCollection(name);
74 } 74 }
75 75
76 static bool IsVector(const std::string& name) {
77 return name == "Vector" ||
78 name == "HeapVector" ||
79 name == "PersistentHeapVector";
80 }
81
76 static bool IsHashMap(const std::string& name) { 82 static bool IsHashMap(const std::string& name) {
77 return name == "HashMap" || 83 return name == "HashMap" ||
78 name == "HeapHashMap" || 84 name == "HeapHashMap" ||
79 name == "PersistentHeapHashMap"; 85 name == "PersistentHeapHashMap";
80 } 86 }
81 87
82 // Assumes name is a valid collection name. 88 // Assumes name is a valid collection name.
83 static size_t CollectionDimension(const std::string& name) { 89 static size_t CollectionDimension(const std::string& name) {
84 return (IsHashMap(name) || name == "pair") ? 2 : 1; 90 return (IsHashMap(name) || name == "pair") ? 2 : 1;
85 } 91 }
86 92
87 static bool IsGCMixinBase(const std::string& name) { 93 static bool IsGCMixinBase(const std::string& name) {
88 return name == "GarbageCollectedMixin"; 94 return name == "GarbageCollectedMixin";
89 } 95 }
90 96
91 static bool IsGCFinalizedBase(const std::string& name) { 97 static bool IsGCFinalizedBase(const std::string& name) {
92 return name == "GarbageCollectedFinalized" || 98 return name == "GarbageCollectedFinalized" ||
93 name == "RefCountedGarbageCollected"; 99 name == "RefCountedGarbageCollected" ||
100 IsGCMixinBase(name);;
94 } 101 }
95 102
96 static bool IsGCBase(const std::string& name) { 103 static bool IsGCBase(const std::string& name) {
97 return name == "GarbageCollected" || 104 return name == "GarbageCollected" ||
98 IsGCFinalizedBase(name) || 105 IsGCFinalizedBase(name);
99 IsGCMixinBase(name);
100 } 106 }
101 107
102 static bool IsVisitor(const std::string& name) { return name == "Visitor"; } 108 static bool IsVisitor(const std::string& name) { return name == "Visitor"; }
103 109
104 static bool IsTraceMethod(clang::CXXMethodDecl* method, 110 static bool IsTraceMethod(clang::CXXMethodDecl* method,
105 bool* isTraceAfterDispatch = 0) { 111 bool* isTraceAfterDispatch = 0) {
106 if (method->getNumParams() != 1) 112 if (method->getNumParams() != 1)
107 return false; 113 return false;
108 114
109 const std::string& name = method->getNameAsString(); 115 const std::string& name = method->getNameAsString();
(...skipping 24 matching lines...) Expand all
134 } 140 }
135 141
136 static bool EndsWith(const std::string& str, const std::string& suffix) { 142 static bool EndsWith(const std::string& str, const std::string& suffix) {
137 if (suffix.size() > str.size()) 143 if (suffix.size() > str.size())
138 return false; 144 return false;
139 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; 145 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
140 } 146 }
141 }; 147 };
142 148
143 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 149 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp ('k') | tools/clang/blink_gc_plugin/Edge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698