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

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

Issue 2578103003: Add use-chromium-style-naming option to Blink GC plugin. (Closed)
Patch Set: Rebase Created 3 years, 12 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
« no previous file with comments | « tools/clang/blink_gc_plugin/CMakeLists.txt ('k') | tools/clang/blink_gc_plugin/Config.cpp » ('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 // 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.
11 11
12 #ifndef TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 12 #ifndef TOOLS_BLINK_GC_PLUGIN_CONFIG_H_
13 #define TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 13 #define TOOLS_BLINK_GC_PLUGIN_CONFIG_H_
14 14
15 #include <cassert> 15 #include <cassert>
16 16
17 #include "clang/AST/AST.h" 17 #include "clang/AST/AST.h"
18 #include "clang/AST/Attr.h" 18 #include "clang/AST/Attr.h"
19 19
20 const char kNewOperatorName[] = "operator new"; 20 extern const char kNewOperatorName[];
21 const char kCreateName[] = "create"; 21 extern const char* kCreateName;
22 const char kTraceName[] = "trace"; 22 extern const char* kTraceName;
23 const char kTraceImplName[] = "traceImpl"; 23 extern const char* kTraceImplName;
24 const char kFinalizeName[] = "finalizeGarbageCollectedObject"; 24 extern const char* kFinalizeName;
25 const char kTraceAfterDispatchName[] = "traceAfterDispatch"; 25 extern const char* kTraceAfterDispatchName;
26 const char kTraceAfterDispatchImplName[] = "traceAfterDispatchImpl"; 26 extern const char* kTraceAfterDispatchImplName;
27 const char kRegisterWeakMembersName[] = "registerWeakMembers"; 27 extern const char* kRegisterWeakMembersName;
28 const char kHeapAllocatorName[] = "HeapAllocator"; 28 extern const char kHeapAllocatorName[];
29 const char kTraceIfNeededName[] = "TraceIfNeeded"; 29 extern const char kTraceIfNeededName[];
30 const char kVisitorDispatcherName[] = "VisitorDispatcher"; 30 extern const char kVisitorDispatcherName[];
31 const char kVisitorVarName[] = "visitor"; 31 extern const char kVisitorVarName[];
32 const char kAdjustAndMarkName[] = "adjustAndMark"; 32 extern const char* kAdjustAndMarkName;
33 const char kIsHeapObjectAliveName[] = "isHeapObjectAlive"; 33 extern const char* kIsHeapObjectAliveName;
34 const char kIsEagerlyFinalizedName[] = "IsEagerlyFinalizedMarker"; 34 extern const char kIsEagerlyFinalizedName[];
35 const char kConstIteratorName[] = "const_iterator"; 35 extern const char kConstIteratorName[];
36 const char kIteratorName[] = "iterator"; 36 extern const char kIteratorName[];
37 const char kConstReverseIteratorName[] = "const_reverse_iterator"; 37 extern const char kConstReverseIteratorName[];
38 const char kReverseIteratorName[] = "reverse_iterator"; 38 extern const char kReverseIteratorName[];
39 39
40 class Config { 40 class Config {
41 public: 41 public:
42 static void UseLegacyNames();
43
42 static bool IsMember(const std::string& name) { 44 static bool IsMember(const std::string& name) {
43 return name == "Member"; 45 return name == "Member";
44 } 46 }
45 47
46 static bool IsWeakMember(const std::string& name) { 48 static bool IsWeakMember(const std::string& name) {
47 return name == "WeakMember"; 49 return name == "WeakMember";
48 } 50 }
49 51
50 static bool IsMemberHandle(const std::string& name) { 52 static bool IsMemberHandle(const std::string& name) {
51 return IsMember(name) || 53 return IsMember(name) ||
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (suffix.size() > str.size()) 271 if (suffix.size() > str.size())
270 return false; 272 return false;
271 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0; 273 return str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
272 } 274 }
273 275
274 // Test if a template specialization is an instantiation. 276 // Test if a template specialization is an instantiation.
275 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record); 277 static bool IsTemplateInstantiation(clang::CXXRecordDecl* record);
276 }; 278 };
277 279
278 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_ 280 #endif // TOOLS_BLINK_GC_PLUGIN_CONFIG_H_
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/CMakeLists.txt ('k') | tools/clang/blink_gc_plugin/Config.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698