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

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

Issue 1135333007: Revert of Revert "win: Make oilpan plugin work better with delayed template parsing." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: copyright Created 5 years, 7 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
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 208
209 enum TraceMethodType { 209 enum TraceMethodType {
210 NOT_TRACE_METHOD, 210 NOT_TRACE_METHOD,
211 TRACE_METHOD, 211 TRACE_METHOD,
212 TRACE_AFTER_DISPATCH_METHOD, 212 TRACE_AFTER_DISPATCH_METHOD,
213 TRACE_IMPL_METHOD, 213 TRACE_IMPL_METHOD,
214 TRACE_AFTER_DISPATCH_IMPL_METHOD 214 TRACE_AFTER_DISPATCH_IMPL_METHOD
215 }; 215 };
216 216
217 static TraceMethodType GetTraceMethodType(clang::FunctionDecl* method) { 217 static TraceMethodType GetTraceMethodType(const clang::FunctionDecl* method) {
218 if (method->getNumParams() != 1) 218 if (method->getNumParams() != 1)
219 return NOT_TRACE_METHOD; 219 return NOT_TRACE_METHOD;
220 220
221 const std::string& name = method->getNameAsString(); 221 const std::string& name = method->getNameAsString();
222 if (name != kTraceName && name != kTraceAfterDispatchName && 222 if (name != kTraceName && name != kTraceAfterDispatchName &&
223 name != kTraceImplName && name != kTraceAfterDispatchImplName) 223 name != kTraceImplName && name != kTraceAfterDispatchImplName)
224 return NOT_TRACE_METHOD; 224 return NOT_TRACE_METHOD;
225 225
226 const clang::QualType& formal_type = method->getParamDecl(0)->getType(); 226 const clang::QualType& formal_type = method->getParamDecl(0)->getType();
227 if (name == kTraceImplName || name == kTraceAfterDispatchImplName) { 227 if (name == kTraceImplName || name == kTraceAfterDispatchImplName) {
228 if (!IsVisitorDispatcherType(formal_type)) 228 if (!IsVisitorDispatcherType(formal_type))
229 return NOT_TRACE_METHOD; 229 return NOT_TRACE_METHOD;
230 } else if (!IsVisitorPtrType(formal_type)) { 230 } else if (!IsVisitorPtrType(formal_type)) {
231 return NOT_TRACE_METHOD; 231 return NOT_TRACE_METHOD;
232 } 232 }
233 233
234 if (name == kTraceName) 234 if (name == kTraceName)
235 return TRACE_METHOD; 235 return TRACE_METHOD;
236 if (name == kTraceAfterDispatchName) 236 if (name == kTraceAfterDispatchName)
237 return TRACE_AFTER_DISPATCH_METHOD; 237 return TRACE_AFTER_DISPATCH_METHOD;
238 if (name == kTraceImplName) 238 if (name == kTraceImplName)
239 return TRACE_IMPL_METHOD; 239 return TRACE_IMPL_METHOD;
240 if (name == kTraceAfterDispatchImplName) 240 if (name == kTraceAfterDispatchImplName)
241 return TRACE_AFTER_DISPATCH_IMPL_METHOD; 241 return TRACE_AFTER_DISPATCH_IMPL_METHOD;
242 242
243 assert(false && "Should not reach here"); 243 assert(false && "Should not reach here");
244 return NOT_TRACE_METHOD; 244 return NOT_TRACE_METHOD;
245 } 245 }
246 246
247 static bool IsTraceMethod(clang::FunctionDecl* method) { 247 static bool IsTraceMethod(const clang::FunctionDecl* method) {
248 return GetTraceMethodType(method) != NOT_TRACE_METHOD; 248 return GetTraceMethodType(method) != NOT_TRACE_METHOD;
249 } 249 }
250 250
251 static bool IsTraceImplName(const std::string& name) { 251 static bool IsTraceImplName(const std::string& name) {
252 return name == kTraceImplName || name == kTraceAfterDispatchImplName; 252 return name == kTraceImplName || name == kTraceAfterDispatchImplName;
253 } 253 }
254 254
255 static bool StartsWith(const std::string& str, const std::string& prefix) { 255 static bool StartsWith(const std::string& str, const std::string& prefix) {
256 if (prefix.size() > str.size()) 256 if (prefix.size() > str.size())
257 return false; 257 return false;
258 return str.compare(0, prefix.size(), prefix) == 0; 258 return str.compare(0, prefix.size(), prefix) == 0;
259 } 259 }
260 260
261 static bool EndsWith(const std::string& str, const std::string& suffix) { 261 static bool EndsWith(const std::string& str, const std::string& suffix) {
262 if (suffix.size() > str.size()) 262 if (suffix.size() > str.size())
263 return false; 263 return false;
264 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; 264 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
265 } 265 }
266 }; 266 };
267 267
268 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 268 #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/tests/delayed_parsing.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698