brintos

brintos / llvm-project-archived public Read only

0
0
Text · 32.5 KiB · 24e7fb6 Raw
695 lines · cpp
1//===- unittest/AST/ASTImporterTest.cpp - AST node import test ------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// Type-parameterized tests for the correct import of redecl chains.10//11//===----------------------------------------------------------------------===//12 13#include "ASTImporterFixtures.h"14 15namespace clang {16namespace ast_matchers {17 18using internal::BindableMatcher;19 20struct Function {21  using DeclTy = FunctionDecl;22  static constexpr auto *Prototype = "void X();";23  static constexpr auto *Definition = "void X() {}";24  BindableMatcher<Decl> getPattern() {25    return functionDecl(hasName("X"), unless(isImplicit()));26  }27};28 29struct Class {30  using DeclTy = CXXRecordDecl;31  static constexpr auto *Prototype = "class X;";32  static constexpr auto *Definition = "class X {};";33  BindableMatcher<Decl> getPattern() {34    return cxxRecordDecl(hasName("X"), unless(isImplicit()));35  }36};37 38struct EnumClass {39  using DeclTy = EnumDecl;40  static constexpr auto *Prototype = "enum class X;";41  static constexpr auto *Definition = "enum class X {};";42  BindableMatcher<Decl> getPattern() {43    return enumDecl(hasName("X"), unless(isImplicit()));44  }45};46 47struct Variable {48  using DeclTy = VarDecl;49  static constexpr auto *Prototype = "extern int X;";50  static constexpr auto *Definition = "int X;";51  BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); }52};53 54struct FunctionTemplate {55  using DeclTy = FunctionTemplateDecl;56  static constexpr auto *Prototype = "template <class T> void X();";57  static constexpr auto *Definition =58      R"(59      template <class T> void X() {};60      // Explicit instantiation is a must because of -fdelayed-template-parsing:61      template void X<int>();62      )";63  BindableMatcher<Decl> getPattern() {64    return functionTemplateDecl(hasName("X"), unless(isImplicit()));65  }66};67 68struct ClassTemplate {69  using DeclTy = ClassTemplateDecl;70  static constexpr auto *Prototype = "template <class T> class X;";71  static constexpr auto *Definition = "template <class T> class X {};";72  BindableMatcher<Decl> getPattern() {73    return classTemplateDecl(hasName("X"), unless(isImplicit()));74  }75};76 77struct VariableTemplate {78  using DeclTy = VarTemplateDecl;79  static constexpr auto *Prototype = "template <class T> extern T X;";80  static constexpr auto *Definition =81      R"(82      template <class T> T X;83      )";84  // There is no matcher for varTemplateDecl so use a work-around.85  BindableMatcher<Decl> getPattern() {86    return namedDecl(hasName("X"), unless(isImplicit()),87                     has(templateTypeParmDecl()));88  }89};90 91struct FunctionTemplateSpec {92  using DeclTy = FunctionDecl;93  static constexpr auto *Prototype =94      R"(95      // Proto of the primary template.96      template <class T>97      void X();98      // Proto of the specialization.99      template <>100      void X<int>();101      )";102  static constexpr auto *Definition =103      R"(104      // Proto of the primary template.105      template <class T>106      void X();107      // Specialization and definition.108      template <>109      void X<int>() {}110      )";111  BindableMatcher<Decl> getPattern() {112    return functionDecl(hasName("X"), isExplicitTemplateSpecialization());113  }114};115 116struct ClassTemplateSpec {117  using DeclTy = ClassTemplateSpecializationDecl;118  static constexpr auto *Prototype =119      R"(120      template <class T> class X;121      template <> class X<int>;122      )";123  static constexpr auto *Definition =124      R"(125      template <class T> class X;126      template <> class X<int> {};127      )";128  BindableMatcher<Decl> getPattern() {129    return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));130  }131};132 133const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateDecl>134    varTemplateDecl;135const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateSpecializationDecl>136    varTemplateSpecializationDecl;137 138struct VariableTemplateSpec {139  using DeclTy = VarTemplateSpecializationDecl;140  static constexpr auto *Prototype =141      R"(142      template <class T> extern T X;143      template <> extern int X<int>;144      )";145  static constexpr auto *Definition =146      R"(147      template <class T> T X;148      template <> int X<int>;149      )";150  BindableMatcher<Decl> getPattern() {151    return varTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));152  }153};154 155template <typename TypeParam>156struct RedeclChain : ASTImporterOptionSpecificTestBase {157 158  using DeclTy = typename TypeParam::DeclTy;159  std::string getPrototype() { return TypeParam::Prototype; }160  std::string getDefinition() { return TypeParam::Definition; }161  BindableMatcher<Decl> getPattern() const { return TypeParam().getPattern(); }162 163  void CheckPreviousDecl(Decl *Prev, Decl *Current) {164    ASSERT_NE(Prev, Current);165    ASSERT_EQ(&Prev->getASTContext(), &Current->getASTContext());166    EXPECT_EQ(Prev->getCanonicalDecl(), Current->getCanonicalDecl());167 168    // Templates.169    if (auto *PrevT = dyn_cast<TemplateDecl>(Prev)) {170      EXPECT_EQ(Current->getPreviousDecl(), Prev);171      auto *CurrentT = cast<TemplateDecl>(Current);172      ASSERT_TRUE(PrevT->getTemplatedDecl());173      ASSERT_TRUE(CurrentT->getTemplatedDecl());174      EXPECT_EQ(CurrentT->getTemplatedDecl()->getPreviousDecl(),175                PrevT->getTemplatedDecl());176      return;177    }178 179    // Specializations.180    if (auto *PrevF = dyn_cast<FunctionDecl>(Prev)) {181      if (PrevF->getTemplatedKind() ==182          FunctionDecl::TK_FunctionTemplateSpecialization) {183        // There may be a hidden fwd spec decl before a spec decl.184        // In that case the previous visible decl can be reached through that185        // invisible one.186        EXPECT_THAT(Prev, testing::AnyOf(187                              Current->getPreviousDecl(),188                              Current->getPreviousDecl()->getPreviousDecl()));189        auto *ToTU = Prev->getTranslationUnitDecl();190        auto *TemplateD = FirstDeclMatcher<FunctionTemplateDecl>().match(191            ToTU, functionTemplateDecl());192        auto *FirstSpecD = *(TemplateD->spec_begin());193        EXPECT_EQ(FirstSpecD->getCanonicalDecl(), PrevF->getCanonicalDecl());194        return;195      }196    }197 198    // The rest: Classes, Functions, etc.199    EXPECT_EQ(Current->getPreviousDecl(), Prev);200  }201 202  void203  TypedTest_PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition() {204    Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03);205    auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());206    ASSERT_FALSE(FromD->isThisDeclarationADefinition());207 208    Decl *ImportedD = Import(FromD, Lang_CXX03);209    Decl *ToTU = ImportedD->getTranslationUnitDecl();210 211    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);212    auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());213    EXPECT_TRUE(ImportedD == ToD);214    EXPECT_FALSE(ToD->isThisDeclarationADefinition());215    if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) {216      EXPECT_TRUE(ToT->getTemplatedDecl());217    }218  }219 220  void TypedTest_DefinitionShouldBeImportedAsADefinition() {221    Decl *FromTU = getTuDecl(getDefinition(), Lang_CXX03);222    auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());223    ASSERT_TRUE(FromD->isThisDeclarationADefinition());224 225    Decl *ImportedD = Import(FromD, Lang_CXX03);226    Decl *ToTU = ImportedD->getTranslationUnitDecl();227 228    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);229    auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());230    EXPECT_TRUE(ToD->isThisDeclarationADefinition());231    if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) {232      EXPECT_TRUE(ToT->getTemplatedDecl());233    }234  }235 236  void TypedTest_ImportPrototypeAfterImportedPrototype() {237    Decl *FromTU = getTuDecl(getPrototype() + getPrototype(), Lang_CXX03);238    auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());239    auto *From1 = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());240    ASSERT_FALSE(From0->isThisDeclarationADefinition());241    ASSERT_FALSE(From1->isThisDeclarationADefinition());242 243    Decl *Imported0 = Import(From0, Lang_CXX03);244    Decl *Imported1 = Import(From1, Lang_CXX03);245    Decl *ToTU = Imported0->getTranslationUnitDecl();246 247    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);248    auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());249    auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());250    EXPECT_TRUE(Imported0 == To0);251    EXPECT_TRUE(Imported1 == To1);252    EXPECT_FALSE(To0->isThisDeclarationADefinition());253    EXPECT_FALSE(To1->isThisDeclarationADefinition());254 255    CheckPreviousDecl(To0, To1);256  }257 258  void TypedTest_ImportDefinitionAfterImportedPrototype() {259    Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);260    auto *FromProto = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());261    auto *FromDef = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());262    ASSERT_FALSE(FromProto->isThisDeclarationADefinition());263    ASSERT_TRUE(FromDef->isThisDeclarationADefinition());264 265    Decl *ImportedProto = Import(FromProto, Lang_CXX03);266    Decl *ImportedDef = Import(FromDef, Lang_CXX03);267    Decl *ToTU = ImportedProto->getTranslationUnitDecl();268 269    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);270    auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());271    auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());272    EXPECT_TRUE(ImportedProto == ToProto);273    EXPECT_TRUE(ImportedDef == ToDef);274    EXPECT_FALSE(ToProto->isThisDeclarationADefinition());275    EXPECT_TRUE(ToDef->isThisDeclarationADefinition());276 277    CheckPreviousDecl(ToProto, ToDef);278  }279 280  void TypedTest_ImportPrototypeAfterImportedDefinition() {281    Decl *FromTU = getTuDecl(getDefinition() + getPrototype(), Lang_CXX03);282    auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());283    auto *FromProto = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());284    ASSERT_TRUE(FromDef->isThisDeclarationADefinition());285    ASSERT_FALSE(FromProto->isThisDeclarationADefinition());286 287    Decl *ImportedDef = Import(FromDef, Lang_CXX03);288    Decl *ImportedProto = Import(FromProto, Lang_CXX03);289    Decl *ToTU = ImportedDef->getTranslationUnitDecl();290 291    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);292    auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());293    auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());294    EXPECT_TRUE(ImportedDef == ToDef);295    EXPECT_TRUE(ImportedProto == ToProto);296    EXPECT_TRUE(ToDef->isThisDeclarationADefinition());297    EXPECT_FALSE(ToProto->isThisDeclarationADefinition());298 299    CheckPreviousDecl(ToDef, ToProto);300  }301 302  void TypedTest_ImportPrototypes() {303    Decl *FromTU0 = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");304    Decl *FromTU1 = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");305    auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());306    auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());307    ASSERT_FALSE(From0->isThisDeclarationADefinition());308    ASSERT_FALSE(From1->isThisDeclarationADefinition());309 310    Decl *Imported0 = Import(From0, Lang_CXX03);311    Decl *Imported1 = Import(From1, Lang_CXX03);312    Decl *ToTU = Imported0->getTranslationUnitDecl();313 314    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);315    auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());316    auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());317    EXPECT_TRUE(Imported0 == To0);318    EXPECT_TRUE(Imported1 == To1);319    EXPECT_FALSE(To0->isThisDeclarationADefinition());320    EXPECT_FALSE(To1->isThisDeclarationADefinition());321 322    CheckPreviousDecl(To0, To1);323  }324 325  void TypedTest_ImportDefinitions() {326    Decl *FromTU0 = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");327    Decl *FromTU1 = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");328    auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());329    auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());330    ASSERT_TRUE(From0->isThisDeclarationADefinition());331    ASSERT_TRUE(From1->isThisDeclarationADefinition());332 333    Decl *Imported0 = Import(From0, Lang_CXX03);334    Decl *Imported1 = Import(From1, Lang_CXX03);335    Decl *ToTU = Imported0->getTranslationUnitDecl();336 337    EXPECT_EQ(Imported0, Imported1);338    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);339    auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());340    EXPECT_TRUE(Imported0 == To0);341    EXPECT_TRUE(To0->isThisDeclarationADefinition());342    if (auto *ToT0 = dyn_cast<TemplateDecl>(To0)) {343      EXPECT_TRUE(ToT0->getTemplatedDecl());344    }345  }346 347  void TypedTest_ImportDefinitionThenPrototype() {348    Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");349    Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");350    auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());351    auto *FromProto =352        FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());353    ASSERT_TRUE(FromDef->isThisDeclarationADefinition());354    ASSERT_FALSE(FromProto->isThisDeclarationADefinition());355 356    Decl *ImportedDef = Import(FromDef, Lang_CXX03);357    Decl *ImportedProto = Import(FromProto, Lang_CXX03);358    Decl *ToTU = ImportedDef->getTranslationUnitDecl();359 360    EXPECT_NE(ImportedDef, ImportedProto);361    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);362    auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());363    auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());364    EXPECT_TRUE(ImportedDef == ToDef);365    EXPECT_TRUE(ImportedProto == ToProto);366    EXPECT_TRUE(ToDef->isThisDeclarationADefinition());367    EXPECT_FALSE(ToProto->isThisDeclarationADefinition());368 369    CheckPreviousDecl(ToDef, ToProto);370  }371 372  void TypedTest_ImportPrototypeThenDefinition() {373    Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");374    Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");375    auto *FromProto =376        FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());377    auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());378    ASSERT_TRUE(FromDef->isThisDeclarationADefinition());379    ASSERT_FALSE(FromProto->isThisDeclarationADefinition());380 381    Decl *ImportedProto = Import(FromProto, Lang_CXX03);382    Decl *ImportedDef = Import(FromDef, Lang_CXX03);383    Decl *ToTU = ImportedDef->getTranslationUnitDecl();384 385    EXPECT_NE(ImportedDef, ImportedProto);386    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);387    auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());388    auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());389    EXPECT_TRUE(ImportedDef == ToDef);390    EXPECT_TRUE(ImportedProto == ToProto);391    EXPECT_TRUE(ToDef->isThisDeclarationADefinition());392    EXPECT_FALSE(ToProto->isThisDeclarationADefinition());393 394    CheckPreviousDecl(ToProto, ToDef);395  }396 397  void TypedTest_WholeRedeclChainIsImportedAtOnce() {398    Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);399    auto *FromD = // Definition400        LastDeclMatcher<DeclTy>().match(FromTU, getPattern());401    ASSERT_TRUE(FromD->isThisDeclarationADefinition());402 403    Decl *ImportedD = Import(FromD, Lang_CXX03);404    Decl *ToTU = ImportedD->getTranslationUnitDecl();405 406    // The whole redecl chain is imported at once.407    EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);408    EXPECT_TRUE(cast<DeclTy>(ImportedD)->isThisDeclarationADefinition());409  }410 411  void TypedTest_ImportPrototypeThenProtoAndDefinition() {412    {413      Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");414      auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());415      Import(FromD, Lang_CXX03);416    }417    {418      Decl *FromTU =419          getTuDecl(getPrototype() + getDefinition(), Lang_CXX03, "input1.cc");420      auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());421      Import(FromD, Lang_CXX03);422    }423 424    Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();425 426    ASSERT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 3u);427    DeclTy *ProtoD = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());428    EXPECT_FALSE(ProtoD->isThisDeclarationADefinition());429 430    DeclTy *DefinitionD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());431    EXPECT_TRUE(DefinitionD->isThisDeclarationADefinition());432 433    EXPECT_TRUE(DefinitionD->getPreviousDecl());434    EXPECT_FALSE(435        DefinitionD->getPreviousDecl()->isThisDeclarationADefinition());436 437    CheckPreviousDecl(ProtoD, DefinitionD->getPreviousDecl());438  }439};440 441#define ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(BaseTemplate, TypeParam,       \442                                                NamePrefix, TestCase)          \443  using BaseTemplate##TypeParam = BaseTemplate<TypeParam>;                     \444  TEST_P(BaseTemplate##TypeParam, NamePrefix##TestCase) {                      \445    TypedTest_##TestCase();                                                    \446  }447 448ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(449    RedeclChain, Function, ,450    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)451ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(452    RedeclChain, Class, ,453    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)454ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(455    RedeclChain, EnumClass, ,456    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)457ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(458    RedeclChain, Variable, ,459    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)460ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(461    RedeclChain, FunctionTemplate, ,462    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)463ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(464    RedeclChain, ClassTemplate, ,465    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)466ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(467    RedeclChain, VariableTemplate, ,468    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)469ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(470    RedeclChain, FunctionTemplateSpec, ,471    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)472ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(473    RedeclChain, ClassTemplateSpec, ,474    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)475ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(476    RedeclChain, VariableTemplateSpec, ,477    PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)478 479ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,480                                        DefinitionShouldBeImportedAsADefinition)481ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,482                                        DefinitionShouldBeImportedAsADefinition)483ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,484                                        DefinitionShouldBeImportedAsADefinition)485ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,486                                        DefinitionShouldBeImportedAsADefinition)487ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,488                                        DefinitionShouldBeImportedAsADefinition)489ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,490                                        DefinitionShouldBeImportedAsADefinition)491ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,492                                        DefinitionShouldBeImportedAsADefinition)493ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,494                                        DefinitionShouldBeImportedAsADefinition)495ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,496                                        DefinitionShouldBeImportedAsADefinition)497ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(498    RedeclChain, VariableTemplateSpec, ,499    DefinitionShouldBeImportedAsADefinition)500 501ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,502                                        ImportPrototypeAfterImportedPrototype)503ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,504                                        ImportPrototypeAfterImportedPrototype)505ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,506                                        ImportPrototypeAfterImportedPrototype)507ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,508                                        ImportPrototypeAfterImportedPrototype)509ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,510                                        ImportPrototypeAfterImportedPrototype)511ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,512                                        ImportPrototypeAfterImportedPrototype)513ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,514                                        ImportPrototypeAfterImportedPrototype)515ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,516                                        ImportPrototypeAfterImportedPrototype)517ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,518                                        ImportPrototypeAfterImportedPrototype)519ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,520                                         ImportPrototypeAfterImportedPrototype)521 522ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,523                                        ImportDefinitionAfterImportedPrototype)524ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,525                                        ImportDefinitionAfterImportedPrototype)526ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,527                                        ImportDefinitionAfterImportedPrototype)528ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,529                                        ImportDefinitionAfterImportedPrototype)530ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,531                                        ImportDefinitionAfterImportedPrototype)532ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,533                                        ImportDefinitionAfterImportedPrototype)534ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,535                                        ImportDefinitionAfterImportedPrototype)536ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,537                                        ImportDefinitionAfterImportedPrototype)538ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,539                                        ImportDefinitionAfterImportedPrototype)540ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,541                                         ImportDefinitionAfterImportedPrototype)542 543ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,544                                        ImportPrototypeAfterImportedDefinition)545ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,546                                        ImportPrototypeAfterImportedDefinition)547ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,548                                        ImportPrototypeAfterImportedDefinition)549ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,550                                        ImportPrototypeAfterImportedDefinition)551ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,552                                        ImportPrototypeAfterImportedDefinition)553ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,554                                        ImportPrototypeAfterImportedDefinition)555ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,556                                        ImportPrototypeAfterImportedDefinition)557ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,558                                        ImportPrototypeAfterImportedDefinition)559ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,560                                        ImportPrototypeAfterImportedDefinition)561ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,562                                         ImportPrototypeAfterImportedDefinition)563 564ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,565                                        ImportPrototypes)566ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, , ImportPrototypes)567ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,568                                        ImportPrototypes)569ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,570                                        ImportPrototypes)571ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,572                                        ImportPrototypes)573ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,574                                        ImportPrototypes)575ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,576                                        ImportPrototypes)577ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,578                                        ImportPrototypes)579ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,580                                        ImportPrototypes)581ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,582                                         ImportPrototypes)583 584ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,585                                        ImportDefinitions)586ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, , ImportDefinitions)587ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,588                                        ImportDefinitions)589ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,590                                        ImportDefinitions)591ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,592                                        ImportDefinitions)593ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,594                                        ImportDefinitions)595ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,596                                        ImportDefinitions)597ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,598                                        ImportDefinitions)599ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,600                                        ImportDefinitions)601ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,602                                         ImportDefinitions)603 604ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,605                                        ImportDefinitionThenPrototype)606ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,607                                        ImportDefinitionThenPrototype)608ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,609                                        ImportDefinitionThenPrototype)610ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,611                                        ImportDefinitionThenPrototype)612ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,613                                        ImportDefinitionThenPrototype)614ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,615                                        ImportDefinitionThenPrototype)616ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,617                                        ImportDefinitionThenPrototype)618ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,619                                        ImportDefinitionThenPrototype)620ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,621                                        ImportDefinitionThenPrototype)622ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,623                                         ImportDefinitionThenPrototype)624 625ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,626                                        ImportPrototypeThenDefinition)627ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,628                                        ImportPrototypeThenDefinition)629ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,630                                        ImportPrototypeThenDefinition)631ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,632                                        ImportPrototypeThenDefinition)633ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,634                                        ImportPrototypeThenDefinition)635ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,636                                        ImportPrototypeThenDefinition)637ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,638                                        ImportPrototypeThenDefinition)639ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,640                                        ImportPrototypeThenDefinition)641ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,642                                        ImportPrototypeThenDefinition)643ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,644                                         ImportPrototypeThenDefinition)645 646ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,647                                        WholeRedeclChainIsImportedAtOnce)648ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,649                                        WholeRedeclChainIsImportedAtOnce)650ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,651                                        WholeRedeclChainIsImportedAtOnce)652ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,653                                        WholeRedeclChainIsImportedAtOnce)654ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,655                                        WholeRedeclChainIsImportedAtOnce)656ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,657                                         WholeRedeclChainIsImportedAtOnce)658 659ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,660                                        ImportPrototypeThenProtoAndDefinition)661ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,662                                        ImportPrototypeThenProtoAndDefinition)663ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,664                                        ImportPrototypeThenProtoAndDefinition)665ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,666                                        ImportPrototypeThenProtoAndDefinition)667ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,668                                        ImportPrototypeThenProtoAndDefinition)669ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,670                                         ImportPrototypeThenProtoAndDefinition)671 672INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunction,673                        DefaultTestValuesForRunOptions);674INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClass,675                        DefaultTestValuesForRunOptions);676INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainEnumClass,677                        DefaultTestValuesForRunOptions);678INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariable,679                        DefaultTestValuesForRunOptions);680INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunctionTemplate,681                        DefaultTestValuesForRunOptions);682INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClassTemplate,683                        DefaultTestValuesForRunOptions);684INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariableTemplate,685                        DefaultTestValuesForRunOptions);686INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunctionTemplateSpec,687                        DefaultTestValuesForRunOptions);688INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClassTemplateSpec,689                        DefaultTestValuesForRunOptions);690INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariableTemplateSpec,691                         DefaultTestValuesForRunOptions);692 693} // end namespace ast_matchers694} // end namespace clang695