Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / unittests / AST / ASTImporterGenericRedeclTest.cpp
blob24e7fb6373f7f089232fef5f806ed0c162ce988c
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.
11 //===----------------------------------------------------------------------===//
13 #include "ASTImporterFixtures.h"
15 namespace clang {
16 namespace ast_matchers {
18 using internal::BindableMatcher;
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()));
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()));
38 struct 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()));
47 struct 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")); }
54 struct 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()));
68 struct 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()));
77 struct 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()));
91 struct 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>();
102 static constexpr auto *Definition =
104 // Proto of the primary template.
105 template <class T>
106 void X();
107 // Specialization and definition.
108 template <>
109 void X<int>() {}
111 BindableMatcher<Decl> getPattern() {
112 return functionDecl(hasName("X"), isExplicitTemplateSpecialization());
116 struct ClassTemplateSpec {
117 using DeclTy = ClassTemplateSpecializationDecl;
118 static constexpr auto *Prototype =
120 template <class T> class X;
121 template <> class X<int>;
123 static constexpr auto *Definition =
125 template <class T> class X;
126 template <> class X<int> {};
128 BindableMatcher<Decl> getPattern() {
129 return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
133 const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateDecl>
134 varTemplateDecl;
135 const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateSpecializationDecl>
136 varTemplateSpecializationDecl;
138 struct VariableTemplateSpec {
139 using DeclTy = VarTemplateSpecializationDecl;
140 static constexpr auto *Prototype =
142 template <class T> extern T X;
143 template <> extern int X<int>;
145 static constexpr auto *Definition =
147 template <class T> T X;
148 template <> int X<int>;
150 BindableMatcher<Decl> getPattern() {
151 return varTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
155 template <typename TypeParam>
156 struct RedeclChain : ASTImporterOptionSpecificTestBase {
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(); }
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());
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;
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 that
185 // 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;
198 // The rest: Classes, Functions, etc.
199 EXPECT_EQ(Current->getPreviousDecl(), Prev);
202 void
203 TypedTest_PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition() {
204 Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03);
205 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
206 ASSERT_FALSE(FromD->isThisDeclarationADefinition());
208 Decl *ImportedD = Import(FromD, Lang_CXX03);
209 Decl *ToTU = ImportedD->getTranslationUnitDecl();
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());
220 void TypedTest_DefinitionShouldBeImportedAsADefinition() {
221 Decl *FromTU = getTuDecl(getDefinition(), Lang_CXX03);
222 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
223 ASSERT_TRUE(FromD->isThisDeclarationADefinition());
225 Decl *ImportedD = Import(FromD, Lang_CXX03);
226 Decl *ToTU = ImportedD->getTranslationUnitDecl();
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());
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());
243 Decl *Imported0 = Import(From0, Lang_CXX03);
244 Decl *Imported1 = Import(From1, Lang_CXX03);
245 Decl *ToTU = Imported0->getTranslationUnitDecl();
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());
255 CheckPreviousDecl(To0, To1);
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());
265 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
266 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
267 Decl *ToTU = ImportedProto->getTranslationUnitDecl();
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());
277 CheckPreviousDecl(ToProto, ToDef);
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());
287 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
288 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
289 Decl *ToTU = ImportedDef->getTranslationUnitDecl();
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());
299 CheckPreviousDecl(ToDef, ToProto);
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());
310 Decl *Imported0 = Import(From0, Lang_CXX03);
311 Decl *Imported1 = Import(From1, Lang_CXX03);
312 Decl *ToTU = Imported0->getTranslationUnitDecl();
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());
322 CheckPreviousDecl(To0, To1);
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());
333 Decl *Imported0 = Import(From0, Lang_CXX03);
334 Decl *Imported1 = Import(From1, Lang_CXX03);
335 Decl *ToTU = Imported0->getTranslationUnitDecl();
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());
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());
356 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
357 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
358 Decl *ToTU = ImportedDef->getTranslationUnitDecl();
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());
369 CheckPreviousDecl(ToDef, ToProto);
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());
381 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
382 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
383 Decl *ToTU = ImportedDef->getTranslationUnitDecl();
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());
394 CheckPreviousDecl(ToProto, ToDef);
397 void TypedTest_WholeRedeclChainIsImportedAtOnce() {
398 Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);
399 auto *FromD = // Definition
400 LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
401 ASSERT_TRUE(FromD->isThisDeclarationADefinition());
403 Decl *ImportedD = Import(FromD, Lang_CXX03);
404 Decl *ToTU = ImportedD->getTranslationUnitDecl();
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());
411 void TypedTest_ImportPrototypeThenProtoAndDefinition() {
413 Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
414 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
415 Import(FromD, Lang_CXX03);
418 Decl *FromTU =
419 getTuDecl(getPrototype() + getDefinition(), Lang_CXX03, "input1.cc");
420 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
421 Import(FromD, Lang_CXX03);
424 Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
426 ASSERT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 3u);
427 DeclTy *ProtoD = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
428 EXPECT_FALSE(ProtoD->isThisDeclarationADefinition());
430 DeclTy *DefinitionD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
431 EXPECT_TRUE(DefinitionD->isThisDeclarationADefinition());
433 EXPECT_TRUE(DefinitionD->getPreviousDecl());
434 EXPECT_FALSE(
435 DefinitionD->getPreviousDecl()->isThisDeclarationADefinition());
437 CheckPreviousDecl(ProtoD, DefinitionD->getPreviousDecl());
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(); \
448 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
449 RedeclChain, Function, ,
450 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
451 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
452 RedeclChain, Class, ,
453 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
454 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
455 RedeclChain, EnumClass, ,
456 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
457 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
458 RedeclChain, Variable, ,
459 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
460 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
461 RedeclChain, FunctionTemplate, ,
462 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
463 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
464 RedeclChain, ClassTemplate, ,
465 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
466 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
467 RedeclChain, VariableTemplate, ,
468 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
469 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
470 RedeclChain, FunctionTemplateSpec, ,
471 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
472 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
473 RedeclChain, ClassTemplateSpec, ,
474 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
475 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
476 RedeclChain, VariableTemplateSpec, ,
477 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
479 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
480 DefinitionShouldBeImportedAsADefinition)
481 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
482 DefinitionShouldBeImportedAsADefinition)
483 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
484 DefinitionShouldBeImportedAsADefinition)
485 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
486 DefinitionShouldBeImportedAsADefinition)
487 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
488 DefinitionShouldBeImportedAsADefinition)
489 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
490 DefinitionShouldBeImportedAsADefinition)
491 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
492 DefinitionShouldBeImportedAsADefinition)
493 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
494 DefinitionShouldBeImportedAsADefinition)
495 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
496 DefinitionShouldBeImportedAsADefinition)
497 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
498 RedeclChain, VariableTemplateSpec, ,
499 DefinitionShouldBeImportedAsADefinition)
501 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
502 ImportPrototypeAfterImportedPrototype)
503 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
504 ImportPrototypeAfterImportedPrototype)
505 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
506 ImportPrototypeAfterImportedPrototype)
507 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
508 ImportPrototypeAfterImportedPrototype)
509 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
510 ImportPrototypeAfterImportedPrototype)
511 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
512 ImportPrototypeAfterImportedPrototype)
513 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
514 ImportPrototypeAfterImportedPrototype)
515 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
516 ImportPrototypeAfterImportedPrototype)
517 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
518 ImportPrototypeAfterImportedPrototype)
519 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
520 ImportPrototypeAfterImportedPrototype)
522 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
523 ImportDefinitionAfterImportedPrototype)
524 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
525 ImportDefinitionAfterImportedPrototype)
526 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
527 ImportDefinitionAfterImportedPrototype)
528 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
529 ImportDefinitionAfterImportedPrototype)
530 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
531 ImportDefinitionAfterImportedPrototype)
532 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
533 ImportDefinitionAfterImportedPrototype)
534 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
535 ImportDefinitionAfterImportedPrototype)
536 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
537 ImportDefinitionAfterImportedPrototype)
538 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
539 ImportDefinitionAfterImportedPrototype)
540 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
541 ImportDefinitionAfterImportedPrototype)
543 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
544 ImportPrototypeAfterImportedDefinition)
545 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
546 ImportPrototypeAfterImportedDefinition)
547 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
548 ImportPrototypeAfterImportedDefinition)
549 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
550 ImportPrototypeAfterImportedDefinition)
551 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
552 ImportPrototypeAfterImportedDefinition)
553 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
554 ImportPrototypeAfterImportedDefinition)
555 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
556 ImportPrototypeAfterImportedDefinition)
557 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
558 ImportPrototypeAfterImportedDefinition)
559 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
560 ImportPrototypeAfterImportedDefinition)
561 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
562 ImportPrototypeAfterImportedDefinition)
564 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
565 ImportPrototypes)
566 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, , ImportPrototypes)
567 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
568 ImportPrototypes)
569 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
570 ImportPrototypes)
571 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
572 ImportPrototypes)
573 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
574 ImportPrototypes)
575 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
576 ImportPrototypes)
577 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
578 ImportPrototypes)
579 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
580 ImportPrototypes)
581 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
582 ImportPrototypes)
584 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
585 ImportDefinitions)
586 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, , ImportDefinitions)
587 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
588 ImportDefinitions)
589 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
590 ImportDefinitions)
591 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
592 ImportDefinitions)
593 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
594 ImportDefinitions)
595 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
596 ImportDefinitions)
597 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
598 ImportDefinitions)
599 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
600 ImportDefinitions)
601 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
602 ImportDefinitions)
604 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
605 ImportDefinitionThenPrototype)
606 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
607 ImportDefinitionThenPrototype)
608 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
609 ImportDefinitionThenPrototype)
610 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
611 ImportDefinitionThenPrototype)
612 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
613 ImportDefinitionThenPrototype)
614 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
615 ImportDefinitionThenPrototype)
616 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
617 ImportDefinitionThenPrototype)
618 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
619 ImportDefinitionThenPrototype)
620 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
621 ImportDefinitionThenPrototype)
622 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
623 ImportDefinitionThenPrototype)
625 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
626 ImportPrototypeThenDefinition)
627 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
628 ImportPrototypeThenDefinition)
629 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
630 ImportPrototypeThenDefinition)
631 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
632 ImportPrototypeThenDefinition)
633 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
634 ImportPrototypeThenDefinition)
635 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
636 ImportPrototypeThenDefinition)
637 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
638 ImportPrototypeThenDefinition)
639 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
640 ImportPrototypeThenDefinition)
641 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
642 ImportPrototypeThenDefinition)
643 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
644 ImportPrototypeThenDefinition)
646 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
647 WholeRedeclChainIsImportedAtOnce)
648 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
649 WholeRedeclChainIsImportedAtOnce)
650 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
651 WholeRedeclChainIsImportedAtOnce)
652 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
653 WholeRedeclChainIsImportedAtOnce)
654 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
655 WholeRedeclChainIsImportedAtOnce)
656 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
657 WholeRedeclChainIsImportedAtOnce)
659 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
660 ImportPrototypeThenProtoAndDefinition)
661 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
662 ImportPrototypeThenProtoAndDefinition)
663 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
664 ImportPrototypeThenProtoAndDefinition)
665 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
666 ImportPrototypeThenProtoAndDefinition)
667 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
668 ImportPrototypeThenProtoAndDefinition)
669 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplateSpec, ,
670 ImportPrototypeThenProtoAndDefinition)
672 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunction,
673 DefaultTestValuesForRunOptions);
674 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClass,
675 DefaultTestValuesForRunOptions);
676 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainEnumClass,
677 DefaultTestValuesForRunOptions);
678 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariable,
679 DefaultTestValuesForRunOptions);
680 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunctionTemplate,
681 DefaultTestValuesForRunOptions);
682 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClassTemplate,
683 DefaultTestValuesForRunOptions);
684 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariableTemplate,
685 DefaultTestValuesForRunOptions);
686 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunctionTemplateSpec,
687 DefaultTestValuesForRunOptions);
688 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClassTemplateSpec,
689 DefaultTestValuesForRunOptions);
690 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariableTemplateSpec,
691 DefaultTestValuesForRunOptions);
693 } // end namespace ast_matchers
694 } // end namespace clang