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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // Type-parameterized tests for the correct import of redecl chains. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "ASTImporterFixtures.h" 14 15 namespace clang { 16 namespace ast_matchers { 17 18 using internal::BindableMatcher; 19 20 struct 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 29 struct 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 38 struct Variable { 39 using DeclTy = VarDecl; 40 static constexpr auto *Prototype = "extern int X;"; 41 static constexpr auto *Definition = "int X;"; 42 BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); } 43 }; 44 45 struct FunctionTemplate { 46 using DeclTy = FunctionTemplateDecl; 47 static constexpr auto *Prototype = "template <class T> void X();"; 48 static constexpr auto *Definition = 49 R"( 50 template <class T> void X() {}; 51 // Explicit instantiation is a must because of -fdelayed-template-parsing: 52 template void X<int>(); 53 )"; 54 BindableMatcher<Decl> getPattern() { 55 return functionTemplateDecl(hasName("X"), unless(isImplicit())); 56 } 57 }; 58 59 struct ClassTemplate { 60 using DeclTy = ClassTemplateDecl; 61 static constexpr auto *Prototype = "template <class T> class X;"; 62 static constexpr auto *Definition = "template <class T> class X {};"; 63 BindableMatcher<Decl> getPattern() { 64 return classTemplateDecl(hasName("X"), unless(isImplicit())); 65 } 66 }; 67 68 struct FunctionTemplateSpec { 69 using DeclTy = FunctionDecl; 70 static constexpr auto *Prototype = 71 R"( 72 // Proto of the primary template. 73 template <class T> 74 void X(); 75 // Proto of the specialization. 76 template <> 77 void X<int>(); 78 )"; 79 static constexpr auto *Definition = 80 R"( 81 // Proto of the primary template. 82 template <class T> 83 void X(); 84 // Specialization and definition. 85 template <> 86 void X<int>() {} 87 )"; 88 BindableMatcher<Decl> getPattern() { 89 return functionDecl(hasName("X"), isExplicitTemplateSpecialization()); 90 } 91 }; 92 93 struct ClassTemplateSpec { 94 using DeclTy = ClassTemplateSpecializationDecl; 95 static constexpr auto *Prototype = 96 R"( 97 template <class T> class X; 98 template <> class X<int>; 99 )"; 100 static constexpr auto *Definition = 101 R"( 102 template <class T> class X; 103 template <> class X<int> {}; 104 )"; 105 BindableMatcher<Decl> getPattern() { 106 return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit())); 107 } 108 }; 109 110 template <typename TypeParam> 111 struct RedeclChain : ASTImporterOptionSpecificTestBase { 112 113 using DeclTy = typename TypeParam::DeclTy; 114 std::string getPrototype() { return TypeParam::Prototype; } 115 std::string getDefinition() { return TypeParam::Definition; } 116 BindableMatcher<Decl> getPattern() const { return TypeParam().getPattern(); } 117 118 void CheckPreviousDecl(Decl *Prev, Decl *Current) { 119 ASSERT_NE(Prev, Current); 120 ASSERT_EQ(&Prev->getASTContext(), &Current->getASTContext()); 121 EXPECT_EQ(Prev->getCanonicalDecl(), Current->getCanonicalDecl()); 122 123 // Templates. 124 if (auto *PrevT = dyn_cast<TemplateDecl>(Prev)) { 125 EXPECT_EQ(Current->getPreviousDecl(), Prev); 126 auto *CurrentT = cast<TemplateDecl>(Current); 127 ASSERT_TRUE(PrevT->getTemplatedDecl()); 128 ASSERT_TRUE(CurrentT->getTemplatedDecl()); 129 EXPECT_EQ(CurrentT->getTemplatedDecl()->getPreviousDecl(), 130 PrevT->getTemplatedDecl()); 131 return; 132 } 133 134 // Specializations. 135 if (auto *PrevF = dyn_cast<FunctionDecl>(Prev)) { 136 if (PrevF->getTemplatedKind() == 137 FunctionDecl::TK_FunctionTemplateSpecialization) { 138 // There may be a hidden fwd spec decl before a spec decl. 139 // In that case the previous visible decl can be reached through that 140 // invisible one. 141 EXPECT_THAT(Prev, testing::AnyOf( 142 Current->getPreviousDecl(), 143 Current->getPreviousDecl()->getPreviousDecl())); 144 auto *ToTU = Prev->getTranslationUnitDecl(); 145 auto *TemplateD = FirstDeclMatcher<FunctionTemplateDecl>().match( 146 ToTU, functionTemplateDecl()); 147 auto *FirstSpecD = *(TemplateD->spec_begin()); 148 EXPECT_EQ(FirstSpecD->getCanonicalDecl(), PrevF->getCanonicalDecl()); 149 return; 150 } 151 } 152 153 // The rest: Classes, Functions, etc. 154 EXPECT_EQ(Current->getPreviousDecl(), Prev); 155 } 156 157 void 158 TypedTest_PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition() { 159 Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX); 160 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern()); 161 ASSERT_FALSE(FromD->isThisDeclarationADefinition()); 162 163 Decl *ImportedD = Import(FromD, Lang_CXX); 164 Decl *ToTU = ImportedD->getTranslationUnitDecl(); 165 166 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u); 167 auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 168 EXPECT_TRUE(ImportedD == ToD); 169 EXPECT_FALSE(ToD->isThisDeclarationADefinition()); 170 if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) { 171 EXPECT_TRUE(ToT->getTemplatedDecl()); 172 } 173 } 174 175 void TypedTest_DefinitionShouldBeImportedAsADefinition() { 176 Decl *FromTU = getTuDecl(getDefinition(), Lang_CXX); 177 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern()); 178 ASSERT_TRUE(FromD->isThisDeclarationADefinition()); 179 180 Decl *ImportedD = Import(FromD, Lang_CXX); 181 Decl *ToTU = ImportedD->getTranslationUnitDecl(); 182 183 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u); 184 auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 185 EXPECT_TRUE(ToD->isThisDeclarationADefinition()); 186 if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) { 187 EXPECT_TRUE(ToT->getTemplatedDecl()); 188 } 189 } 190 191 void TypedTest_ImportPrototypeAfterImportedPrototype() { 192 Decl *FromTU = getTuDecl(getPrototype() + getPrototype(), Lang_CXX); 193 auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern()); 194 auto *From1 = LastDeclMatcher<DeclTy>().match(FromTU, getPattern()); 195 ASSERT_FALSE(From0->isThisDeclarationADefinition()); 196 ASSERT_FALSE(From1->isThisDeclarationADefinition()); 197 198 Decl *Imported0 = Import(From0, Lang_CXX); 199 Decl *Imported1 = Import(From1, Lang_CXX); 200 Decl *ToTU = Imported0->getTranslationUnitDecl(); 201 202 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u); 203 auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 204 auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 205 EXPECT_TRUE(Imported0 == To0); 206 EXPECT_TRUE(Imported1 == To1); 207 EXPECT_FALSE(To0->isThisDeclarationADefinition()); 208 EXPECT_FALSE(To1->isThisDeclarationADefinition()); 209 210 CheckPreviousDecl(To0, To1); 211 } 212 213 void TypedTest_ImportDefinitionAfterImportedPrototype() { 214 Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX); 215 auto *FromProto = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern()); 216 auto *FromDef = LastDeclMatcher<DeclTy>().match(FromTU, getPattern()); 217 ASSERT_FALSE(FromProto->isThisDeclarationADefinition()); 218 ASSERT_TRUE(FromDef->isThisDeclarationADefinition()); 219 220 Decl *ImportedProto = Import(FromProto, Lang_CXX); 221 Decl *ImportedDef = Import(FromDef, Lang_CXX); 222 Decl *ToTU = ImportedProto->getTranslationUnitDecl(); 223 224 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u); 225 auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 226 auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 227 EXPECT_TRUE(ImportedProto == ToProto); 228 EXPECT_TRUE(ImportedDef == ToDef); 229 EXPECT_FALSE(ToProto->isThisDeclarationADefinition()); 230 EXPECT_TRUE(ToDef->isThisDeclarationADefinition()); 231 232 CheckPreviousDecl(ToProto, ToDef); 233 } 234 235 void TypedTest_ImportPrototypeAfterImportedDefinition() { 236 Decl *FromTU = getTuDecl(getDefinition() + getPrototype(), Lang_CXX); 237 auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern()); 238 auto *FromProto = LastDeclMatcher<DeclTy>().match(FromTU, getPattern()); 239 ASSERT_TRUE(FromDef->isThisDeclarationADefinition()); 240 ASSERT_FALSE(FromProto->isThisDeclarationADefinition()); 241 242 Decl *ImportedDef = Import(FromDef, Lang_CXX); 243 Decl *ImportedProto = Import(FromProto, Lang_CXX); 244 Decl *ToTU = ImportedDef->getTranslationUnitDecl(); 245 246 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u); 247 auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 248 auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 249 EXPECT_TRUE(ImportedDef == ToDef); 250 EXPECT_TRUE(ImportedProto == ToProto); 251 EXPECT_TRUE(ToDef->isThisDeclarationADefinition()); 252 EXPECT_FALSE(ToProto->isThisDeclarationADefinition()); 253 254 CheckPreviousDecl(ToDef, ToProto); 255 } 256 257 void TypedTest_ImportPrototypes() { 258 Decl *FromTU0 = getTuDecl(getPrototype(), Lang_CXX, "input0.cc"); 259 Decl *FromTU1 = getTuDecl(getPrototype(), Lang_CXX, "input1.cc"); 260 auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern()); 261 auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern()); 262 ASSERT_FALSE(From0->isThisDeclarationADefinition()); 263 ASSERT_FALSE(From1->isThisDeclarationADefinition()); 264 265 Decl *Imported0 = Import(From0, Lang_CXX); 266 Decl *Imported1 = Import(From1, Lang_CXX); 267 Decl *ToTU = Imported0->getTranslationUnitDecl(); 268 269 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u); 270 auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 271 auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 272 EXPECT_TRUE(Imported0 == To0); 273 EXPECT_TRUE(Imported1 == To1); 274 EXPECT_FALSE(To0->isThisDeclarationADefinition()); 275 EXPECT_FALSE(To1->isThisDeclarationADefinition()); 276 277 CheckPreviousDecl(To0, To1); 278 } 279 280 void TypedTest_ImportDefinitions() { 281 Decl *FromTU0 = getTuDecl(getDefinition(), Lang_CXX, "input0.cc"); 282 Decl *FromTU1 = getTuDecl(getDefinition(), Lang_CXX, "input1.cc"); 283 auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern()); 284 auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern()); 285 ASSERT_TRUE(From0->isThisDeclarationADefinition()); 286 ASSERT_TRUE(From1->isThisDeclarationADefinition()); 287 288 Decl *Imported0 = Import(From0, Lang_CXX); 289 Decl *Imported1 = Import(From1, Lang_CXX); 290 Decl *ToTU = Imported0->getTranslationUnitDecl(); 291 292 EXPECT_EQ(Imported0, Imported1); 293 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u); 294 auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 295 EXPECT_TRUE(Imported0 == To0); 296 EXPECT_TRUE(To0->isThisDeclarationADefinition()); 297 if (auto *ToT0 = dyn_cast<TemplateDecl>(To0)) { 298 EXPECT_TRUE(ToT0->getTemplatedDecl()); 299 } 300 } 301 302 void TypedTest_ImportDefinitionThenPrototype() { 303 Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX, "input0.cc"); 304 Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX, "input1.cc"); 305 auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern()); 306 auto *FromProto = 307 FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern()); 308 ASSERT_TRUE(FromDef->isThisDeclarationADefinition()); 309 ASSERT_FALSE(FromProto->isThisDeclarationADefinition()); 310 311 Decl *ImportedDef = Import(FromDef, Lang_CXX); 312 Decl *ImportedProto = Import(FromProto, Lang_CXX); 313 Decl *ToTU = ImportedDef->getTranslationUnitDecl(); 314 315 EXPECT_NE(ImportedDef, ImportedProto); 316 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u); 317 auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 318 auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 319 EXPECT_TRUE(ImportedDef == ToDef); 320 EXPECT_TRUE(ImportedProto == ToProto); 321 EXPECT_TRUE(ToDef->isThisDeclarationADefinition()); 322 EXPECT_FALSE(ToProto->isThisDeclarationADefinition()); 323 324 CheckPreviousDecl(ToDef, ToProto); 325 } 326 327 void TypedTest_ImportPrototypeThenDefinition() { 328 Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX, "input0.cc"); 329 Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX, "input1.cc"); 330 auto *FromProto = 331 FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern()); 332 auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern()); 333 ASSERT_TRUE(FromDef->isThisDeclarationADefinition()); 334 ASSERT_FALSE(FromProto->isThisDeclarationADefinition()); 335 336 Decl *ImportedProto = Import(FromProto, Lang_CXX); 337 Decl *ImportedDef = Import(FromDef, Lang_CXX); 338 Decl *ToTU = ImportedDef->getTranslationUnitDecl(); 339 340 EXPECT_NE(ImportedDef, ImportedProto); 341 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u); 342 auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 343 auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 344 EXPECT_TRUE(ImportedDef == ToDef); 345 EXPECT_TRUE(ImportedProto == ToProto); 346 EXPECT_TRUE(ToDef->isThisDeclarationADefinition()); 347 EXPECT_FALSE(ToProto->isThisDeclarationADefinition()); 348 349 CheckPreviousDecl(ToProto, ToDef); 350 } 351 352 void TypedTest_WholeRedeclChainIsImportedAtOnce() { 353 Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX); 354 auto *FromD = // Definition 355 LastDeclMatcher<DeclTy>().match(FromTU, getPattern()); 356 ASSERT_TRUE(FromD->isThisDeclarationADefinition()); 357 358 Decl *ImportedD = Import(FromD, Lang_CXX); 359 Decl *ToTU = ImportedD->getTranslationUnitDecl(); 360 361 // The whole redecl chain is imported at once. 362 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u); 363 EXPECT_TRUE(cast<DeclTy>(ImportedD)->isThisDeclarationADefinition()); 364 } 365 366 void TypedTest_ImportPrototypeThenProtoAndDefinition() { 367 { 368 Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX, "input0.cc"); 369 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern()); 370 Import(FromD, Lang_CXX); 371 } 372 { 373 Decl *FromTU = 374 getTuDecl(getPrototype() + getDefinition(), Lang_CXX, "input1.cc"); 375 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern()); 376 Import(FromD, Lang_CXX); 377 } 378 379 Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl(); 380 381 ASSERT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 3u); 382 DeclTy *ProtoD = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern()); 383 EXPECT_FALSE(ProtoD->isThisDeclarationADefinition()); 384 385 DeclTy *DefinitionD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern()); 386 EXPECT_TRUE(DefinitionD->isThisDeclarationADefinition()); 387 388 EXPECT_TRUE(DefinitionD->getPreviousDecl()); 389 EXPECT_FALSE( 390 DefinitionD->getPreviousDecl()->isThisDeclarationADefinition()); 391 392 CheckPreviousDecl(ProtoD, DefinitionD->getPreviousDecl()); 393 } 394 }; 395 396 #define ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(BaseTemplate, TypeParam, \ 397 NamePrefix, TestCase) \ 398 using BaseTemplate##TypeParam = BaseTemplate<TypeParam>; \ 399 TEST_P(BaseTemplate##TypeParam, NamePrefix##TestCase) { \ 400 TypedTest_##TestCase(); \ 401 } 402 403 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE( 404 RedeclChain, Function, , 405 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition) 406 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE( 407 RedeclChain, Class, , 408 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition) 409 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE( 410 RedeclChain, Variable, , 411 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition) 412 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE( 413 RedeclChain, FunctionTemplate, , 414 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition) 415 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE( 416 RedeclChain, ClassTemplate, , 417 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition) 418 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE( 419 RedeclChain, FunctionTemplateSpec, , 420 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition) 421 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE( 422 RedeclChain, ClassTemplateSpec, , 423 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition) 424 425 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 426 DefinitionShouldBeImportedAsADefinition) 427 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , 428 DefinitionShouldBeImportedAsADefinition) 429 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 430 DefinitionShouldBeImportedAsADefinition) 431 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 432 DefinitionShouldBeImportedAsADefinition) 433 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 434 DefinitionShouldBeImportedAsADefinition) 435 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 436 DefinitionShouldBeImportedAsADefinition) 437 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 438 DefinitionShouldBeImportedAsADefinition) 439 440 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 441 ImportPrototypeAfterImportedPrototype) 442 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , 443 ImportPrototypeAfterImportedPrototype) 444 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 445 ImportPrototypeAfterImportedPrototype) 446 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 447 ImportPrototypeAfterImportedPrototype) 448 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 449 ImportPrototypeAfterImportedPrototype) 450 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 451 ImportPrototypeAfterImportedPrototype) 452 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 453 ImportPrototypeAfterImportedPrototype) 454 455 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 456 ImportDefinitionAfterImportedPrototype) 457 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , 458 ImportDefinitionAfterImportedPrototype) 459 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 460 ImportDefinitionAfterImportedPrototype) 461 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 462 ImportDefinitionAfterImportedPrototype) 463 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 464 ImportDefinitionAfterImportedPrototype) 465 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 466 ImportDefinitionAfterImportedPrototype) 467 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 468 ImportDefinitionAfterImportedPrototype) 469 470 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 471 ImportPrototypeAfterImportedDefinition) 472 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , 473 ImportPrototypeAfterImportedDefinition) 474 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 475 ImportPrototypeAfterImportedDefinition) 476 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 477 ImportPrototypeAfterImportedDefinition) 478 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 479 ImportPrototypeAfterImportedDefinition) 480 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 481 ImportPrototypeAfterImportedDefinition) 482 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 483 ImportPrototypeAfterImportedDefinition) 484 485 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 486 ImportPrototypes) 487 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , ImportPrototypes) 488 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 489 ImportPrototypes) 490 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 491 ImportPrototypes) 492 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 493 ImportPrototypes) 494 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 495 ImportPrototypes) 496 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 497 ImportPrototypes) 498 499 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 500 ImportDefinitions) 501 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , ImportDefinitions) 502 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 503 ImportDefinitions) 504 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 505 ImportDefinitions) 506 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 507 ImportDefinitions) 508 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 509 ImportDefinitions) 510 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 511 ImportDefinitions) 512 513 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 514 ImportDefinitionThenPrototype) 515 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , 516 ImportDefinitionThenPrototype) 517 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 518 ImportDefinitionThenPrototype) 519 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 520 ImportDefinitionThenPrototype) 521 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 522 ImportDefinitionThenPrototype) 523 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 524 ImportDefinitionThenPrototype) 525 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 526 ImportDefinitionThenPrototype) 527 528 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 529 ImportPrototypeThenDefinition) 530 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Class, , 531 ImportPrototypeThenDefinition) 532 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 533 ImportPrototypeThenDefinition) 534 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 535 ImportPrototypeThenDefinition) 536 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplate, , 537 ImportPrototypeThenDefinition) 538 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 539 ImportPrototypeThenDefinition) 540 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, ClassTemplateSpec, , 541 ImportPrototypeThenDefinition) 542 543 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 544 WholeRedeclChainIsImportedAtOnce) 545 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 546 WholeRedeclChainIsImportedAtOnce) 547 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 548 WholeRedeclChainIsImportedAtOnce) 549 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 550 WholeRedeclChainIsImportedAtOnce) 551 552 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Function, , 553 ImportPrototypeThenProtoAndDefinition) 554 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, Variable, , 555 ImportPrototypeThenProtoAndDefinition) 556 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplate, , 557 ImportPrototypeThenProtoAndDefinition) 558 ASTIMPORTER_INSTANTIATE_TYPED_TEST_CASE(RedeclChain, FunctionTemplateSpec, , 559 ImportPrototypeThenProtoAndDefinition) 560 561 INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainFunction, 562 DefaultTestValuesForRunOptions, ); 563 INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainClass, 564 DefaultTestValuesForRunOptions, ); 565 INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainVariable, 566 DefaultTestValuesForRunOptions, ); 567 INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainFunctionTemplate, 568 DefaultTestValuesForRunOptions, ); 569 INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainClassTemplate, 570 DefaultTestValuesForRunOptions, ); 571 INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainFunctionTemplateSpec, 572 DefaultTestValuesForRunOptions, ); 573 INSTANTIATE_TEST_CASE_P(ParameterizedTests, RedeclChainClassTemplateSpec, 574 DefaultTestValuesForRunOptions, ); 575 576 } // end namespace ast_matchers 577 } // end namespace clang 578