1 // Copyright 2015 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "Config.h" 6 7 #include <cassert> 8 9 #include "clang/AST/AST.h" 10 11 using namespace clang; 12 13 const char kNewOperatorName[] = "operator new"; 14 const char kCreateName[] = "Create"; 15 const char kTraceName[] = "Trace"; 16 const char kFinalizeName[] = "FinalizeGarbageCollectedObject"; 17 const char kTraceAfterDispatchName[] = "TraceAfterDispatch"; 18 const char kRegisterWeakMembersName[] = "RegisterWeakMembers"; 19 const char kHeapAllocatorName[] = "HeapAllocator"; 20 const char kTraceIfNeededName[] = "TraceIfNeeded"; 21 const char kVisitorDispatcherName[] = "VisitorDispatcher"; 22 const char kVisitorVarName[] = "visitor"; 23 const char kAdjustAndMarkName[] = "AdjustAndMark"; 24 const char kIsHeapObjectAliveName[] = "IsHeapObjectAlive"; 25 const char kIsEagerlyFinalizedName[] = "IsEagerlyFinalizedMarker"; 26 const char kConstIteratorName[] = "const_iterator"; 27 const char kIteratorName[] = "iterator"; 28 const char kConstReverseIteratorName[] = "const_reverse_iterator"; 29 const char kReverseIteratorName[] = "reverse_iterator"; 30 IsTemplateInstantiation(CXXRecordDecl * record)31bool Config::IsTemplateInstantiation(CXXRecordDecl* record) { 32 ClassTemplateSpecializationDecl* spec = 33 dyn_cast<clang::ClassTemplateSpecializationDecl>(record); 34 if (!spec) 35 return false; 36 switch (spec->getTemplateSpecializationKind()) { 37 case TSK_ImplicitInstantiation: 38 case TSK_ExplicitInstantiationDefinition: 39 return true; 40 case TSK_Undeclared: 41 case TSK_ExplicitSpecialization: 42 return false; 43 // TODO: unsupported cases. 44 case TSK_ExplicitInstantiationDeclaration: 45 return false; 46 } 47 assert(false && "Unknown template specialization kind"); 48 return false; 49 } 50