| 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 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 static bool IsIgnoreAnnotated(clang::Decl* decl) { | 153 static bool IsIgnoreAnnotated(clang::Decl* decl) { |
| 154 return IsAnnotated(decl, "blink_gc_plugin_ignore"); | 154 return IsAnnotated(decl, "blink_gc_plugin_ignore"); |
| 155 } | 155 } |
| 156 | 156 |
| 157 static bool IsIgnoreCycleAnnotated(clang::Decl* decl) { | 157 static bool IsIgnoreCycleAnnotated(clang::Decl* decl) { |
| 158 return IsAnnotated(decl, "blink_gc_plugin_ignore_cycle") || | 158 return IsAnnotated(decl, "blink_gc_plugin_ignore_cycle") || |
| 159 IsIgnoreAnnotated(decl); | 159 IsIgnoreAnnotated(decl); |
| 160 } | 160 } |
| 161 | 161 |
| 162 static bool IsVisitor(const std::string& name) { return name == "Visitor"; } | 162 static bool IsVisitor(const std::string& name) { |
| 163 return name == "Visitor" || name == "VisitorHelper"; |
| 164 } |
| 163 | 165 |
| 164 static bool IsTraceMethod(clang::FunctionDecl* method, | 166 static bool IsTraceMethod(clang::FunctionDecl* method, |
| 165 bool* isTraceAfterDispatch = 0) { | 167 bool* isTraceAfterDispatch = 0) { |
| 166 if (method->getNumParams() != 1) | 168 if (method->getNumParams() != 1) |
| 167 return false; | 169 return false; |
| 168 | 170 |
| 169 const std::string& name = method->getNameAsString(); | 171 const std::string& name = method->getNameAsString(); |
| 170 if (name != kTraceName && name != kTraceAfterDispatchName) | 172 if (name != kTraceName && name != kTraceAfterDispatchName) |
| 171 return false; | 173 return false; |
| 172 | 174 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 194 } | 196 } |
| 195 | 197 |
| 196 static bool EndsWith(const std::string& str, const std::string& suffix) { | 198 static bool EndsWith(const std::string& str, const std::string& suffix) { |
| 197 if (suffix.size() > str.size()) | 199 if (suffix.size() > str.size()) |
| 198 return false; | 200 return false; |
| 199 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; | 201 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; |
| 200 } | 202 } |
| 201 }; | 203 }; |
| 202 | 204 |
| 203 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ | 205 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ |
| OLD | NEW |