Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / unittests / AST / ASTImporterGenericRedeclTest.cpp
blob1206fac15d4a2410dcbd921d188e6e7fa9652ef3
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 template <> int X<int>;
84 )";
85 // There is no matcher for varTemplateDecl so use a work-around.
86 BindableMatcher<Decl> getPattern() {
87 return namedDecl(hasName("X"), unless(isImplicit()),
88 has(templateTypeParmDecl()));
92 struct FunctionTemplateSpec {
93 using DeclTy = FunctionDecl;
94 static constexpr auto *Prototype =
95 R"(
96 // Proto of the primary template.
97 template <class T>
98 void X();
99 // Proto of the specialization.
100 template <>
101 void X<int>();
103 static constexpr auto *Definition =
105 // Proto of the primary template.
106 template <class T>
107 void X();
108 // Specialization and definition.
109 template <>
110 void X<int>() {}
112 BindableMatcher<Decl> getPattern() {
113 return functionDecl(hasName("X"), isExplicitTemplateSpecialization());
117 struct ClassTemplateSpec {
118 using DeclTy = ClassTemplateSpecializationDecl;
119 static constexpr auto *Prototype =
121 template <class T> class X;
122 template <> class X<int>;
124 static constexpr auto *Definition =
126 template <class T> class X;
127 template <> class X<int> {};
129 BindableMatcher<Decl> getPattern() {
130 return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
134 template <typename TypeParam>
135 struct RedeclChain : ASTImporterOptionSpecificTestBase {
137 using DeclTy = typename TypeParam::DeclTy;
138 std::string getPrototype() { return TypeParam::Prototype; }
139 std::string getDefinition() { return TypeParam::Definition; }
140 BindableMatcher<Decl> getPattern() const { return TypeParam().getPattern(); }
142 void CheckPreviousDecl(Decl *Prev, Decl *Current) {
143 ASSERT_NE(Prev, Current);
144 ASSERT_EQ(&Prev->getASTContext(), &Current->getASTContext());
145 EXPECT_EQ(Prev->getCanonicalDecl(), Current->getCanonicalDecl());
147 // Templates.
148 if (auto *PrevT = dyn_cast<TemplateDecl>(Prev)) {
149 EXPECT_EQ(Current->getPreviousDecl(), Prev);
150 auto *CurrentT = cast<TemplateDecl>(Current);
151 ASSERT_TRUE(PrevT->getTemplatedDecl());
152 ASSERT_TRUE(CurrentT->getTemplatedDecl());
153 EXPECT_EQ(CurrentT->getTemplatedDecl()->getPreviousDecl(),
154 PrevT->getTemplatedDecl());
155 return;
158 // Specializations.
159 if (auto *PrevF = dyn_cast<FunctionDecl>(Prev)) {
160 if (PrevF->getTemplatedKind() ==
161 FunctionDecl::TK_FunctionTemplateSpecialization) {
162 // There may be a hidden fwd spec decl before a spec decl.
163 // In that case the previous visible decl can be reached through that
164 // invisible one.
165 EXPECT_THAT(Prev, testing::AnyOf(
166 Current->getPreviousDecl(),
167 Current->getPreviousDecl()->getPreviousDecl()));
168 auto *ToTU = Prev->getTranslationUnitDecl();
169 auto *TemplateD = FirstDeclMatcher<FunctionTemplateDecl>().match(
170 ToTU, functionTemplateDecl());
171 auto *FirstSpecD = *(TemplateD->spec_begin());
172 EXPECT_EQ(FirstSpecD->getCanonicalDecl(), PrevF->getCanonicalDecl());
173 return;
177 // The rest: Classes, Functions, etc.
178 EXPECT_EQ(Current->getPreviousDecl(), Prev);
181 void
182 TypedTest_PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition() {
183 Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03);
184 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
185 ASSERT_FALSE(FromD->isThisDeclarationADefinition());
187 Decl *ImportedD = Import(FromD, Lang_CXX03);
188 Decl *ToTU = ImportedD->getTranslationUnitDecl();
190 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
191 auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
192 EXPECT_TRUE(ImportedD == ToD);
193 EXPECT_FALSE(ToD->isThisDeclarationADefinition());
194 if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) {
195 EXPECT_TRUE(ToT->getTemplatedDecl());
199 void TypedTest_DefinitionShouldBeImportedAsADefinition() {
200 Decl *FromTU = getTuDecl(getDefinition(), Lang_CXX03);
201 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
202 ASSERT_TRUE(FromD->isThisDeclarationADefinition());
204 Decl *ImportedD = Import(FromD, Lang_CXX03);
205 Decl *ToTU = ImportedD->getTranslationUnitDecl();
207 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
208 auto *ToD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
209 EXPECT_TRUE(ToD->isThisDeclarationADefinition());
210 if (auto *ToT = dyn_cast<TemplateDecl>(ToD)) {
211 EXPECT_TRUE(ToT->getTemplatedDecl());
215 void TypedTest_ImportPrototypeAfterImportedPrototype() {
216 Decl *FromTU = getTuDecl(getPrototype() + getPrototype(), Lang_CXX03);
217 auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
218 auto *From1 = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
219 ASSERT_FALSE(From0->isThisDeclarationADefinition());
220 ASSERT_FALSE(From1->isThisDeclarationADefinition());
222 Decl *Imported0 = Import(From0, Lang_CXX03);
223 Decl *Imported1 = Import(From1, Lang_CXX03);
224 Decl *ToTU = Imported0->getTranslationUnitDecl();
226 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
227 auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
228 auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
229 EXPECT_TRUE(Imported0 == To0);
230 EXPECT_TRUE(Imported1 == To1);
231 EXPECT_FALSE(To0->isThisDeclarationADefinition());
232 EXPECT_FALSE(To1->isThisDeclarationADefinition());
234 CheckPreviousDecl(To0, To1);
237 void TypedTest_ImportDefinitionAfterImportedPrototype() {
238 Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);
239 auto *FromProto = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
240 auto *FromDef = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
241 ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
242 ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
244 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
245 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
246 Decl *ToTU = ImportedProto->getTranslationUnitDecl();
248 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
249 auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
250 auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
251 EXPECT_TRUE(ImportedProto == ToProto);
252 EXPECT_TRUE(ImportedDef == ToDef);
253 EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
254 EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
256 CheckPreviousDecl(ToProto, ToDef);
259 void TypedTest_ImportPrototypeAfterImportedDefinition() {
260 Decl *FromTU = getTuDecl(getDefinition() + getPrototype(), Lang_CXX03);
261 auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
262 auto *FromProto = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
263 ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
264 ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
266 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
267 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
268 Decl *ToTU = ImportedDef->getTranslationUnitDecl();
270 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
271 auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
272 auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
273 EXPECT_TRUE(ImportedDef == ToDef);
274 EXPECT_TRUE(ImportedProto == ToProto);
275 EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
276 EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
278 CheckPreviousDecl(ToDef, ToProto);
281 void TypedTest_ImportPrototypes() {
282 Decl *FromTU0 = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
283 Decl *FromTU1 = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");
284 auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());
285 auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());
286 ASSERT_FALSE(From0->isThisDeclarationADefinition());
287 ASSERT_FALSE(From1->isThisDeclarationADefinition());
289 Decl *Imported0 = Import(From0, Lang_CXX03);
290 Decl *Imported1 = Import(From1, Lang_CXX03);
291 Decl *ToTU = Imported0->getTranslationUnitDecl();
293 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
294 auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
295 auto *To1 = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
296 EXPECT_TRUE(Imported0 == To0);
297 EXPECT_TRUE(Imported1 == To1);
298 EXPECT_FALSE(To0->isThisDeclarationADefinition());
299 EXPECT_FALSE(To1->isThisDeclarationADefinition());
301 CheckPreviousDecl(To0, To1);
304 void TypedTest_ImportDefinitions() {
305 Decl *FromTU0 = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");
306 Decl *FromTU1 = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");
307 auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());
308 auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());
309 ASSERT_TRUE(From0->isThisDeclarationADefinition());
310 ASSERT_TRUE(From1->isThisDeclarationADefinition());
312 Decl *Imported0 = Import(From0, Lang_CXX03);
313 Decl *Imported1 = Import(From1, Lang_CXX03);
314 Decl *ToTU = Imported0->getTranslationUnitDecl();
316 EXPECT_EQ(Imported0, Imported1);
317 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
318 auto *To0 = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
319 EXPECT_TRUE(Imported0 == To0);
320 EXPECT_TRUE(To0->isThisDeclarationADefinition());
321 if (auto *ToT0 = dyn_cast<TemplateDecl>(To0)) {
322 EXPECT_TRUE(ToT0->getTemplatedDecl());
326 void TypedTest_ImportDefinitionThenPrototype() {
327 Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");
328 Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");
329 auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());
330 auto *FromProto =
331 FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());
332 ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
333 ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
335 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
336 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
337 Decl *ToTU = ImportedDef->getTranslationUnitDecl();
339 EXPECT_NE(ImportedDef, ImportedProto);
340 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
341 auto *ToDef = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
342 auto *ToProto = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
343 EXPECT_TRUE(ImportedDef == ToDef);
344 EXPECT_TRUE(ImportedProto == ToProto);
345 EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
346 EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
348 CheckPreviousDecl(ToDef, ToProto);
351 void TypedTest_ImportPrototypeThenDefinition() {
352 Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
353 Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");
354 auto *FromProto =
355 FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());
356 auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());
357 ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
358 ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
360 Decl *ImportedProto = Import(FromProto, Lang_CXX03);
361 Decl *ImportedDef = Import(FromDef, Lang_CXX03);
362 Decl *ToTU = ImportedDef->getTranslationUnitDecl();
364 EXPECT_NE(ImportedDef, ImportedProto);
365 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
366 auto *ToProto = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
367 auto *ToDef = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
368 EXPECT_TRUE(ImportedDef == ToDef);
369 EXPECT_TRUE(ImportedProto == ToProto);
370 EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
371 EXPECT_FALSE(ToProto->isThisDeclarationADefinition());
373 CheckPreviousDecl(ToProto, ToDef);
376 void TypedTest_WholeRedeclChainIsImportedAtOnce() {
377 Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);
378 auto *FromD = // Definition
379 LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
380 ASSERT_TRUE(FromD->isThisDeclarationADefinition());
382 Decl *ImportedD = Import(FromD, Lang_CXX03);
383 Decl *ToTU = ImportedD->getTranslationUnitDecl();
385 // The whole redecl chain is imported at once.
386 EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
387 EXPECT_TRUE(cast<DeclTy>(ImportedD)->isThisDeclarationADefinition());
390 void TypedTest_ImportPrototypeThenProtoAndDefinition() {
392 Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
393 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
394 Import(FromD, Lang_CXX03);
397 Decl *FromTU =
398 getTuDecl(getPrototype() + getDefinition(), Lang_CXX03, "input1.cc");
399 auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
400 Import(FromD, Lang_CXX03);
403 Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
405 ASSERT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 3u);
406 DeclTy *ProtoD = FirstDeclMatcher<DeclTy>().match(ToTU, getPattern());
407 EXPECT_FALSE(ProtoD->isThisDeclarationADefinition());
409 DeclTy *DefinitionD = LastDeclMatcher<DeclTy>().match(ToTU, getPattern());
410 EXPECT_TRUE(DefinitionD->isThisDeclarationADefinition());
412 EXPECT_TRUE(DefinitionD->getPreviousDecl());
413 EXPECT_FALSE(
414 DefinitionD->getPreviousDecl()->isThisDeclarationADefinition());
416 CheckPreviousDecl(ProtoD, DefinitionD->getPreviousDecl());
420 #define ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(BaseTemplate, TypeParam, \
421 NamePrefix, TestCase) \
422 using BaseTemplate##TypeParam = BaseTemplate<TypeParam>; \
423 TEST_P(BaseTemplate##TypeParam, NamePrefix##TestCase) { \
424 TypedTest_##TestCase(); \
427 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
428 RedeclChain, Function, ,
429 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
430 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
431 RedeclChain, Class, ,
432 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
433 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
434 RedeclChain, EnumClass, ,
435 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
436 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
437 RedeclChain, Variable, ,
438 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
439 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
440 RedeclChain, FunctionTemplate, ,
441 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
442 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
443 RedeclChain, ClassTemplate, ,
444 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
445 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
446 RedeclChain, VariableTemplate, ,
447 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
448 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
449 RedeclChain, FunctionTemplateSpec, ,
450 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
451 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(
452 RedeclChain, ClassTemplateSpec, ,
453 PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition)
455 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
456 DefinitionShouldBeImportedAsADefinition)
457 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
458 DefinitionShouldBeImportedAsADefinition)
459 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
460 DefinitionShouldBeImportedAsADefinition)
461 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
462 DefinitionShouldBeImportedAsADefinition)
463 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
464 DefinitionShouldBeImportedAsADefinition)
465 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
466 DefinitionShouldBeImportedAsADefinition)
467 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
468 DefinitionShouldBeImportedAsADefinition)
469 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
470 DefinitionShouldBeImportedAsADefinition)
471 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
472 DefinitionShouldBeImportedAsADefinition)
474 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
475 ImportPrototypeAfterImportedPrototype)
476 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
477 ImportPrototypeAfterImportedPrototype)
478 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
479 ImportPrototypeAfterImportedPrototype)
480 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
481 ImportPrototypeAfterImportedPrototype)
482 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
483 ImportPrototypeAfterImportedPrototype)
484 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
485 ImportPrototypeAfterImportedPrototype)
486 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
487 ImportPrototypeAfterImportedPrototype)
488 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
489 ImportPrototypeAfterImportedPrototype)
490 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
491 ImportPrototypeAfterImportedPrototype)
493 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
494 ImportDefinitionAfterImportedPrototype)
495 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
496 ImportDefinitionAfterImportedPrototype)
497 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
498 ImportDefinitionAfterImportedPrototype)
499 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
500 ImportDefinitionAfterImportedPrototype)
501 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
502 ImportDefinitionAfterImportedPrototype)
503 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
504 ImportDefinitionAfterImportedPrototype)
505 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
506 ImportDefinitionAfterImportedPrototype)
507 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
508 ImportDefinitionAfterImportedPrototype)
509 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
510 ImportDefinitionAfterImportedPrototype)
512 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
513 ImportPrototypeAfterImportedDefinition)
514 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
515 ImportPrototypeAfterImportedDefinition)
516 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
517 ImportPrototypeAfterImportedDefinition)
518 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
519 ImportPrototypeAfterImportedDefinition)
520 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
521 ImportPrototypeAfterImportedDefinition)
522 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
523 ImportPrototypeAfterImportedDefinition)
524 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
525 ImportPrototypeAfterImportedDefinition)
526 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
527 ImportPrototypeAfterImportedDefinition)
528 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
529 ImportPrototypeAfterImportedDefinition)
531 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
532 ImportPrototypes)
533 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, , ImportPrototypes)
534 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
535 ImportPrototypes)
536 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
537 ImportPrototypes)
538 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
539 ImportPrototypes)
540 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
541 ImportPrototypes)
542 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
543 ImportPrototypes)
544 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
545 ImportPrototypes)
546 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
547 ImportPrototypes)
549 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
550 ImportDefinitions)
551 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, , ImportDefinitions)
552 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
553 ImportDefinitions)
554 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
555 ImportDefinitions)
556 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
557 ImportDefinitions)
558 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
559 ImportDefinitions)
560 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
561 ImportDefinitions)
562 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
563 ImportDefinitions)
564 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
565 ImportDefinitions)
567 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
568 ImportDefinitionThenPrototype)
569 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
570 ImportDefinitionThenPrototype)
571 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
572 ImportDefinitionThenPrototype)
573 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
574 ImportDefinitionThenPrototype)
575 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
576 ImportDefinitionThenPrototype)
577 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
578 ImportDefinitionThenPrototype)
579 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
580 ImportDefinitionThenPrototype)
581 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
582 ImportDefinitionThenPrototype)
583 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
584 ImportDefinitionThenPrototype)
586 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
587 ImportPrototypeThenDefinition)
588 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Class, ,
589 ImportPrototypeThenDefinition)
590 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, EnumClass, ,
591 ImportPrototypeThenDefinition)
592 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
593 ImportPrototypeThenDefinition)
594 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
595 ImportPrototypeThenDefinition)
596 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplate, ,
597 ImportPrototypeThenDefinition)
598 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
599 ImportPrototypeThenDefinition)
600 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
601 ImportPrototypeThenDefinition)
602 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, ClassTemplateSpec, ,
603 ImportPrototypeThenDefinition)
605 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
606 WholeRedeclChainIsImportedAtOnce)
607 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
608 WholeRedeclChainIsImportedAtOnce)
609 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
610 WholeRedeclChainIsImportedAtOnce)
611 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
612 WholeRedeclChainIsImportedAtOnce)
613 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
614 WholeRedeclChainIsImportedAtOnce)
616 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Function, ,
617 ImportPrototypeThenProtoAndDefinition)
618 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, Variable, ,
619 ImportPrototypeThenProtoAndDefinition)
620 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplate, ,
621 ImportPrototypeThenProtoAndDefinition)
622 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, VariableTemplate, ,
623 ImportPrototypeThenProtoAndDefinition)
624 ASTIMPORTER_INSTANTIATE_TYPED_TEST_SUITE(RedeclChain, FunctionTemplateSpec, ,
625 ImportPrototypeThenProtoAndDefinition)
627 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunction,
628 DefaultTestValuesForRunOptions);
629 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClass,
630 DefaultTestValuesForRunOptions);
631 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainEnumClass,
632 DefaultTestValuesForRunOptions);
633 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariable,
634 DefaultTestValuesForRunOptions);
635 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunctionTemplate,
636 DefaultTestValuesForRunOptions);
637 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClassTemplate,
638 DefaultTestValuesForRunOptions);
639 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainVariableTemplate,
640 DefaultTestValuesForRunOptions);
641 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainFunctionTemplateSpec,
642 DefaultTestValuesForRunOptions);
643 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, RedeclChainClassTemplateSpec,
644 DefaultTestValuesForRunOptions);
646 } // end namespace ast_matchers
647 } // end namespace clang