Home | History | Annotate | Download | only in blink_gc_plugin
      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 bool Config::IsTemplateInstantiation(CXXRecordDecl* record) {
     14   ClassTemplateSpecializationDecl* spec =
     15       dyn_cast<clang::ClassTemplateSpecializationDecl>(record);
     16   if (!spec)
     17     return false;
     18   switch (spec->getTemplateSpecializationKind()) {
     19     case TSK_ImplicitInstantiation:
     20     case TSK_ExplicitInstantiationDefinition:
     21       return true;
     22     case TSK_Undeclared:
     23     case TSK_ExplicitSpecialization:
     24       return false;
     25     // TODO: unsupported cases.
     26     case TSK_ExplicitInstantiationDeclaration:
     27       return false;
     28   }
     29   assert(false && "Unknown template specialization kind");
     30   return false;
     31 }
     32