1 //===- unittest/AST/ASTImporterTest.cpp - AST node import test ------------===//
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
7 //===----------------------------------------------------------------------===//
9 // Type-parameterized tests for the correct import of Decls with different
12 //===----------------------------------------------------------------------===//
14 // Define this to have ::testing::Combine available.
15 // FIXME: Better solution for this?
16 #define GTEST_HAS_COMBINE 1
18 #include "ASTImporterFixtures.h"
21 namespace ast_matchers
{
23 using internal::BindableMatcher
;
25 // Type parameters for type-parameterized test fixtures.
26 struct GetFunPattern
{
27 using DeclTy
= FunctionDecl
;
28 BindableMatcher
<Decl
> operator()() { return functionDecl(hasName("f")); }
30 struct GetVarPattern
{
31 using DeclTy
= VarDecl
;
32 BindableMatcher
<Decl
> operator()() { return varDecl(hasName("v")); }
34 struct GetClassPattern
{
35 using DeclTy
= CXXRecordDecl
;
36 BindableMatcher
<Decl
> operator()() { return cxxRecordDecl(hasName("X")); }
38 struct GetEnumPattern
{
39 using DeclTy
= EnumDecl
;
40 BindableMatcher
<Decl
> operator()() { return enumDecl(hasName("E")); }
42 struct GetTypedefNamePattern
{
43 using DeclTy
= TypedefNameDecl
;
44 BindableMatcher
<Decl
> operator()() { return typedefNameDecl(hasName("T")); }
46 struct GetFunTemplPattern
{
47 using DeclTy
= FunctionTemplateDecl
;
48 BindableMatcher
<Decl
> operator()() {
49 return functionTemplateDecl(hasName("f"));
52 struct GetVarTemplPattern
{
53 using DeclTy
= VarTemplateDecl
;
54 BindableMatcher
<Decl
> operator()() {
55 return namedDecl(hasName("v"), has(templateTypeParmDecl()));
58 struct GetClassTemplPattern
{
59 using DeclTy
= ClassTemplateDecl
;
60 BindableMatcher
<Decl
> operator()() { return classTemplateDecl(hasName("X")); }
63 // Values for the value-parameterized test fixtures.
65 const auto *ExternF
= "void f();";
66 const auto *StaticF
= "static void f();";
67 const auto *AnonF
= "namespace { void f(); }";
69 const auto *ExternV
= "extern int v;";
70 const auto *StaticV
= "static int v;";
71 const auto *AnonV
= "namespace { extern int v; }";
73 const auto *ExternC
= "class X;";
74 const auto *AnonC
= "namespace { class X; }";
76 const auto *ExternE
= "enum E {};";
77 const auto *AnonE
= "namespace { enum E {}; }";
78 const auto *ExternEC
= "enum class E;";
79 const auto *AnonEC
= "namespace { enum class E; }";
81 const auto *ExternTypedef
= "typedef int T;";
82 const auto *AnonTypedef
= "namespace { typedef int T; }";
83 const auto *ExternUsing
= "using T = int;";
84 const auto *AnonUsing
= "namespace { using T = int; }";
85 // FunctionTemplateDecl:
86 const auto *ExternFT
= "template <class> void f();";
87 const auto *StaticFT
= "template <class> static void f();";
88 const auto *AnonFT
= "namespace { template <class> void f(); }";
90 const auto *ExternVT
= "template <class> extern int v;";
91 const auto *StaticVT
= "template <class> static int v;";
92 const auto *AnonVT
= "namespace { template <class> extern int v; }";
94 const auto *ExternCT
= "template <class> class X;";
95 const auto *AnonCT
= "namespace { template <class> class X; }";
97 // First value in tuple: Compile options.
98 // Second value in tuple: Source code to be used in the test.
99 using ImportVisibilityChainParams
= ::testing::WithParamInterface
<
100 std::tuple
<std::vector
<std::string
>, const char *>>;
101 // Fixture to test the redecl chain of Decls with the same visibility. Gtest
102 // makes it possible to have either value-parameterized or type-parameterized
103 // fixtures. However, we cannot have both value- and type-parameterized test
104 // fixtures. This is a value-parameterized test fixture in the gtest sense. We
105 // intend to mimic gtest's type-parameters via the PatternFactory template
106 // parameter. We manually instantiate the different tests with the each types.
107 template <typename PatternFactory
>
108 class ImportVisibilityChain
109 : public ASTImporterTestBase
, public ImportVisibilityChainParams
{
111 using DeclTy
= typename
PatternFactory::DeclTy
;
112 std::vector
<std::string
> getExtraArgs() const override
{
113 return std::get
<0>(GetParam());
115 std::string
getCode() const { return std::get
<1>(GetParam()); }
116 BindableMatcher
<Decl
> getPattern() const { return PatternFactory()(); }
118 // Type-parameterized test.
119 void TypedTest_ImportChain() {
120 std::string Code
= getCode() + getCode();
121 auto Pattern
= getPattern();
123 TranslationUnitDecl
*FromTu
= getTuDecl(Code
, Lang_CXX14
, "input0.cc");
125 auto *FromD0
= FirstDeclMatcher
<DeclTy
>().match(FromTu
, Pattern
);
126 auto *FromD1
= LastDeclMatcher
<DeclTy
>().match(FromTu
, Pattern
);
128 auto *ToD0
= Import(FromD0
, Lang_CXX14
);
129 auto *ToD1
= Import(FromD1
, Lang_CXX14
);
133 EXPECT_NE(ToD0
, ToD1
);
134 EXPECT_EQ(ToD1
->getPreviousDecl(), ToD0
);
138 // Manual instantiation of the fixture with each type.
139 using ImportFunctionsVisibilityChain
= ImportVisibilityChain
<GetFunPattern
>;
140 using ImportVariablesVisibilityChain
= ImportVisibilityChain
<GetVarPattern
>;
141 using ImportClassesVisibilityChain
= ImportVisibilityChain
<GetClassPattern
>;
142 using ImportScopedEnumsVisibilityChain
= ImportVisibilityChain
<GetEnumPattern
>;
143 using ImportFunctionTemplatesVisibilityChain
=
144 ImportVisibilityChain
<GetFunTemplPattern
>;
145 using ImportVariableTemplatesVisibilityChain
=
146 ImportVisibilityChain
<GetVarTemplPattern
>;
147 using ImportClassTemplatesVisibilityChain
=
148 ImportVisibilityChain
<GetClassTemplPattern
>;
150 // Value-parameterized test for functions.
151 TEST_P(ImportFunctionsVisibilityChain
, ImportChain
) {
152 TypedTest_ImportChain();
154 // Value-parameterized test for variables.
155 TEST_P(ImportVariablesVisibilityChain
, ImportChain
) {
156 TypedTest_ImportChain();
158 // Value-parameterized test for classes.
159 TEST_P(ImportClassesVisibilityChain
, ImportChain
) {
160 TypedTest_ImportChain();
162 // Value-parameterized test for scoped enums.
163 TEST_P(ImportScopedEnumsVisibilityChain
, ImportChain
) {
164 TypedTest_ImportChain();
166 // Value-parameterized test for function templates.
167 TEST_P(ImportFunctionTemplatesVisibilityChain
, ImportChain
) {
168 TypedTest_ImportChain();
170 // Value-parameterized test for variable templates.
171 TEST_P(ImportVariableTemplatesVisibilityChain
, ImportChain
) {
172 TypedTest_ImportChain();
174 // Value-parameterized test for class templates.
175 TEST_P(ImportClassTemplatesVisibilityChain
, ImportChain
) {
176 TypedTest_ImportChain();
179 // Automatic instantiation of the value-parameterized tests.
180 INSTANTIATE_TEST_SUITE_P(ParameterizedTests
, ImportFunctionsVisibilityChain
,
181 ::testing::Combine(DefaultTestValuesForRunOptions
,
182 ::testing::Values(ExternF
, StaticF
,
184 INSTANTIATE_TEST_SUITE_P(
185 ParameterizedTests
, ImportVariablesVisibilityChain
,
187 DefaultTestValuesForRunOptions
,
188 // There is no point to instantiate with StaticV, because in C++ we can
189 // forward declare a variable only with the 'extern' keyword.
190 // Consequently, each fwd declared variable has external linkage. This
191 // is different in the C language where any declaration without an
192 // initializer is a tentative definition, subsequent definitions may be
193 // provided but they must have the same linkage. See also the test
194 // ImportVariableChainInC which test for this special C Lang case.
195 ::testing::Values(ExternV
, AnonV
)) );
196 INSTANTIATE_TEST_SUITE_P(
197 ParameterizedTests
, ImportClassesVisibilityChain
,
199 DefaultTestValuesForRunOptions
,
200 ::testing::Values(ExternC
, AnonC
)) );
201 INSTANTIATE_TEST_SUITE_P(
202 ParameterizedTests
, ImportScopedEnumsVisibilityChain
,
204 DefaultTestValuesForRunOptions
,
205 ::testing::Values(ExternEC
, AnonEC
)) );
206 INSTANTIATE_TEST_SUITE_P(ParameterizedTests
,
207 ImportFunctionTemplatesVisibilityChain
,
208 ::testing::Combine(DefaultTestValuesForRunOptions
,
209 ::testing::Values(ExternFT
, StaticFT
,
211 INSTANTIATE_TEST_SUITE_P(ParameterizedTests
,
212 ImportVariableTemplatesVisibilityChain
,
213 ::testing::Combine(DefaultTestValuesForRunOptions
,
214 ::testing::Values(ExternVT
,
216 INSTANTIATE_TEST_SUITE_P(ParameterizedTests
, ImportClassTemplatesVisibilityChain
,
217 ::testing::Combine(DefaultTestValuesForRunOptions
,
218 ::testing::Values(ExternCT
,
221 // First value in tuple: Compile options.
222 // Second value in tuple: Tuple with informations for the test.
223 // Code for first import (or initial code), code to import, whether the `f`
224 // functions are expected to be linked in a declaration chain.
225 // One value of this tuple is combined with every value of compile options.
226 // The test can have a single tuple as parameter only.
227 using ImportVisibilityParams
= ::testing::WithParamInterface
<std::tuple
<
228 std::vector
<std::string
>, std::tuple
<const char *, const char *, bool>>>;
230 template <typename PatternFactory
>
231 class ImportVisibility
232 : public ASTImporterTestBase
,
233 public ImportVisibilityParams
{
235 using DeclTy
= typename
PatternFactory::DeclTy
;
236 std::vector
<std::string
> getExtraArgs() const override
{
237 return std::get
<0>(GetParam());
239 std::string
getCode0() const { return std::get
<0>(std::get
<1>(GetParam())); }
240 std::string
getCode1() const { return std::get
<1>(std::get
<1>(GetParam())); }
241 bool shouldBeLinked() const { return std::get
<2>(std::get
<1>(GetParam())); }
242 BindableMatcher
<Decl
> getPattern() const { return PatternFactory()(); }
244 void TypedTest_ImportAfter() {
245 TranslationUnitDecl
*ToTu
= getToTuDecl(getCode0(), Lang_CXX14
);
246 TranslationUnitDecl
*FromTu
=
247 getTuDecl(getCode1(), Lang_CXX14
, "input1.cc");
249 auto *ToD0
= FirstDeclMatcher
<DeclTy
>().match(ToTu
, getPattern());
250 auto *FromD1
= FirstDeclMatcher
<DeclTy
>().match(FromTu
, getPattern());
252 auto *ToD1
= Import(FromD1
, Lang_CXX14
);
256 EXPECT_NE(ToD0
, ToD1
);
258 if (shouldBeLinked())
259 EXPECT_EQ(ToD1
->getPreviousDecl(), ToD0
);
261 EXPECT_FALSE(ToD1
->getPreviousDecl());
264 void TypedTest_ImportAfterImport() {
265 TranslationUnitDecl
*FromTu0
=
266 getTuDecl(getCode0(), Lang_CXX14
, "input0.cc");
267 TranslationUnitDecl
*FromTu1
=
268 getTuDecl(getCode1(), Lang_CXX14
, "input1.cc");
269 auto *FromD0
= FirstDeclMatcher
<DeclTy
>().match(FromTu0
, getPattern());
270 auto *FromD1
= FirstDeclMatcher
<DeclTy
>().match(FromTu1
, getPattern());
271 auto *ToD0
= Import(FromD0
, Lang_CXX14
);
272 auto *ToD1
= Import(FromD1
, Lang_CXX14
);
275 EXPECT_NE(ToD0
, ToD1
);
276 if (shouldBeLinked())
277 EXPECT_EQ(ToD1
->getPreviousDecl(), ToD0
);
279 EXPECT_FALSE(ToD1
->getPreviousDecl());
282 void TypedTest_ImportAfterWithMerge() {
283 TranslationUnitDecl
*ToTu
= getToTuDecl(getCode0(), Lang_CXX14
);
284 TranslationUnitDecl
*FromTu
=
285 getTuDecl(getCode1(), Lang_CXX14
, "input1.cc");
287 auto *ToF0
= FirstDeclMatcher
<DeclTy
>().match(ToTu
, getPattern());
288 auto *FromF1
= FirstDeclMatcher
<DeclTy
>().match(FromTu
, getPattern());
290 auto *ToF1
= Import(FromF1
, Lang_CXX14
);
295 if (shouldBeLinked())
296 EXPECT_EQ(ToF0
, ToF1
);
298 EXPECT_NE(ToF0
, ToF1
);
300 // We expect no (ODR) warning during the import.
301 EXPECT_EQ(0u, ToTu
->getASTContext().getDiagnostics().getNumWarnings());
304 void TypedTest_ImportAfterImportWithMerge() {
305 TranslationUnitDecl
*FromTu0
=
306 getTuDecl(getCode0(), Lang_CXX14
, "input0.cc");
307 TranslationUnitDecl
*FromTu1
=
308 getTuDecl(getCode1(), Lang_CXX14
, "input1.cc");
309 auto *FromF0
= FirstDeclMatcher
<DeclTy
>().match(FromTu0
, getPattern());
310 auto *FromF1
= FirstDeclMatcher
<DeclTy
>().match(FromTu1
, getPattern());
311 auto *ToF0
= Import(FromF0
, Lang_CXX14
);
312 auto *ToF1
= Import(FromF1
, Lang_CXX14
);
315 if (shouldBeLinked())
316 EXPECT_EQ(ToF0
, ToF1
);
318 EXPECT_NE(ToF0
, ToF1
);
320 // We expect no (ODR) warning during the import.
321 EXPECT_EQ(0u, ToF0
->getTranslationUnitDecl()
327 using ImportFunctionsVisibility
= ImportVisibility
<GetFunPattern
>;
328 using ImportVariablesVisibility
= ImportVisibility
<GetVarPattern
>;
329 using ImportClassesVisibility
= ImportVisibility
<GetClassPattern
>;
330 using ImportEnumsVisibility
= ImportVisibility
<GetEnumPattern
>;
331 using ImportScopedEnumsVisibility
= ImportVisibility
<GetEnumPattern
>;
332 using ImportTypedefNameVisibility
= ImportVisibility
<GetTypedefNamePattern
>;
333 using ImportFunctionTemplatesVisibility
= ImportVisibility
<GetFunTemplPattern
>;
334 using ImportVariableTemplatesVisibility
= ImportVisibility
<GetVarTemplPattern
>;
335 using ImportClassTemplatesVisibility
= ImportVisibility
<GetClassTemplPattern
>;
338 TEST_P(ImportFunctionsVisibility
, ImportAfter
) {
339 TypedTest_ImportAfter();
341 TEST_P(ImportFunctionsVisibility
, ImportAfterImport
) {
342 TypedTest_ImportAfterImport();
345 TEST_P(ImportVariablesVisibility
, ImportAfter
) {
346 TypedTest_ImportAfter();
348 TEST_P(ImportVariablesVisibility
, ImportAfterImport
) {
349 TypedTest_ImportAfterImport();
352 TEST_P(ImportClassesVisibility
, ImportAfter
) {
353 TypedTest_ImportAfter();
355 TEST_P(ImportClassesVisibility
, ImportAfterImport
) {
356 TypedTest_ImportAfterImport();
359 TEST_P(ImportEnumsVisibility
, ImportAfter
) {
360 TypedTest_ImportAfterWithMerge();
362 TEST_P(ImportEnumsVisibility
, ImportAfterImport
) {
363 TypedTest_ImportAfterImportWithMerge();
365 TEST_P(ImportScopedEnumsVisibility
, ImportAfter
) {
366 TypedTest_ImportAfter();
368 TEST_P(ImportScopedEnumsVisibility
, ImportAfterImport
) {
369 TypedTest_ImportAfterImport();
372 TEST_P(ImportTypedefNameVisibility
, ImportAfter
) {
373 TypedTest_ImportAfterWithMerge();
375 TEST_P(ImportTypedefNameVisibility
, ImportAfterImport
) {
376 TypedTest_ImportAfterImportWithMerge();
378 // FunctionTemplateDecl.
379 TEST_P(ImportFunctionTemplatesVisibility
, ImportAfter
) {
380 TypedTest_ImportAfter();
382 TEST_P(ImportFunctionTemplatesVisibility
, ImportAfterImport
) {
383 TypedTest_ImportAfterImport();
386 TEST_P(ImportVariableTemplatesVisibility
, ImportAfter
) {
387 TypedTest_ImportAfter();
389 TEST_P(ImportVariableTemplatesVisibility
, ImportAfterImport
) {
390 TypedTest_ImportAfterImport();
392 // ClassTemplateDecl.
393 TEST_P(ImportClassTemplatesVisibility
, ImportAfter
) { TypedTest_ImportAfter(); }
394 TEST_P(ImportClassTemplatesVisibility
, ImportAfterImport
) {
395 TypedTest_ImportAfterImport();
398 const bool ExpectLinkedDeclChain
= true;
399 const bool ExpectUnlinkedDeclChain
= false;
401 INSTANTIATE_TEST_SUITE_P(
402 ParameterizedTests
, ImportFunctionsVisibility
,
404 DefaultTestValuesForRunOptions
,
406 std::make_tuple(ExternF
, ExternF
, ExpectLinkedDeclChain
),
407 std::make_tuple(ExternF
, StaticF
, ExpectUnlinkedDeclChain
),
408 std::make_tuple(ExternF
, AnonF
, ExpectUnlinkedDeclChain
),
409 std::make_tuple(StaticF
, ExternF
, ExpectUnlinkedDeclChain
),
410 std::make_tuple(StaticF
, StaticF
, ExpectUnlinkedDeclChain
),
411 std::make_tuple(StaticF
, AnonF
, ExpectUnlinkedDeclChain
),
412 std::make_tuple(AnonF
, ExternF
, ExpectUnlinkedDeclChain
),
413 std::make_tuple(AnonF
, StaticF
, ExpectUnlinkedDeclChain
),
414 std::make_tuple(AnonF
, AnonF
, ExpectUnlinkedDeclChain
))) );
415 INSTANTIATE_TEST_SUITE_P(
416 ParameterizedTests
, ImportVariablesVisibility
,
418 DefaultTestValuesForRunOptions
,
420 std::make_tuple(ExternV
, ExternV
, ExpectLinkedDeclChain
),
421 std::make_tuple(ExternV
, StaticV
, ExpectUnlinkedDeclChain
),
422 std::make_tuple(ExternV
, AnonV
, ExpectUnlinkedDeclChain
),
423 std::make_tuple(StaticV
, ExternV
, ExpectUnlinkedDeclChain
),
424 std::make_tuple(StaticV
, StaticV
, ExpectUnlinkedDeclChain
),
425 std::make_tuple(StaticV
, AnonV
, ExpectUnlinkedDeclChain
),
426 std::make_tuple(AnonV
, ExternV
, ExpectUnlinkedDeclChain
),
427 std::make_tuple(AnonV
, StaticV
, ExpectUnlinkedDeclChain
),
428 std::make_tuple(AnonV
, AnonV
, ExpectUnlinkedDeclChain
))) );
429 INSTANTIATE_TEST_SUITE_P(
430 ParameterizedTests
, ImportClassesVisibility
,
432 DefaultTestValuesForRunOptions
,
434 std::make_tuple(ExternC
, ExternC
, ExpectLinkedDeclChain
),
435 std::make_tuple(ExternC
, AnonC
, ExpectUnlinkedDeclChain
),
436 std::make_tuple(AnonC
, ExternC
, ExpectUnlinkedDeclChain
),
437 std::make_tuple(AnonC
, AnonC
, ExpectUnlinkedDeclChain
))) );
438 INSTANTIATE_TEST_SUITE_P(
439 ParameterizedTests
, ImportEnumsVisibility
,
441 DefaultTestValuesForRunOptions
,
443 std::make_tuple(ExternE
, ExternE
, ExpectLinkedDeclChain
),
444 std::make_tuple(ExternE
, AnonE
, ExpectUnlinkedDeclChain
),
445 std::make_tuple(AnonE
, ExternE
, ExpectUnlinkedDeclChain
),
446 std::make_tuple(AnonE
, AnonE
, ExpectUnlinkedDeclChain
))) );
447 INSTANTIATE_TEST_SUITE_P(
448 ParameterizedTests
, ImportScopedEnumsVisibility
,
450 DefaultTestValuesForRunOptions
,
452 std::make_tuple(ExternEC
, ExternEC
, ExpectLinkedDeclChain
),
453 std::make_tuple(ExternEC
, AnonEC
, ExpectUnlinkedDeclChain
),
454 std::make_tuple(AnonEC
, ExternEC
, ExpectUnlinkedDeclChain
),
455 std::make_tuple(AnonEC
, AnonEC
, ExpectUnlinkedDeclChain
))) );
456 INSTANTIATE_TEST_SUITE_P(
457 ParameterizedTests
, ImportTypedefNameVisibility
,
459 DefaultTestValuesForRunOptions
,
461 std::make_tuple(ExternTypedef
, ExternTypedef
,
462 ExpectLinkedDeclChain
),
463 std::make_tuple(ExternTypedef
, AnonTypedef
,
464 ExpectUnlinkedDeclChain
),
465 std::make_tuple(AnonTypedef
, ExternTypedef
,
466 ExpectUnlinkedDeclChain
),
467 std::make_tuple(AnonTypedef
, AnonTypedef
, ExpectUnlinkedDeclChain
),
469 std::make_tuple(ExternUsing
, ExternUsing
, ExpectLinkedDeclChain
),
470 std::make_tuple(ExternUsing
, AnonUsing
, ExpectUnlinkedDeclChain
),
471 std::make_tuple(AnonUsing
, ExternUsing
, ExpectUnlinkedDeclChain
),
472 std::make_tuple(AnonUsing
, AnonUsing
, ExpectUnlinkedDeclChain
),
474 std::make_tuple(ExternUsing
, ExternTypedef
, ExpectLinkedDeclChain
),
475 std::make_tuple(ExternUsing
, AnonTypedef
, ExpectUnlinkedDeclChain
),
476 std::make_tuple(AnonUsing
, ExternTypedef
, ExpectUnlinkedDeclChain
),
477 std::make_tuple(AnonUsing
, AnonTypedef
, ExpectUnlinkedDeclChain
),
479 std::make_tuple(ExternTypedef
, ExternUsing
, ExpectLinkedDeclChain
),
480 std::make_tuple(ExternTypedef
, AnonUsing
, ExpectUnlinkedDeclChain
),
481 std::make_tuple(AnonTypedef
, ExternUsing
, ExpectUnlinkedDeclChain
),
482 std::make_tuple(AnonTypedef
, AnonUsing
,
483 ExpectUnlinkedDeclChain
))) );
484 INSTANTIATE_TEST_SUITE_P(
485 ParameterizedTests
, ImportFunctionTemplatesVisibility
,
487 DefaultTestValuesForRunOptions
,
489 std::make_tuple(ExternFT
, ExternFT
, ExpectLinkedDeclChain
),
490 std::make_tuple(ExternFT
, StaticFT
, ExpectUnlinkedDeclChain
),
491 std::make_tuple(ExternFT
, AnonFT
, ExpectUnlinkedDeclChain
),
492 std::make_tuple(StaticFT
, ExternFT
, ExpectUnlinkedDeclChain
),
493 std::make_tuple(StaticFT
, StaticFT
, ExpectUnlinkedDeclChain
),
494 std::make_tuple(StaticFT
, AnonFT
, ExpectUnlinkedDeclChain
),
495 std::make_tuple(AnonFT
, ExternFT
, ExpectUnlinkedDeclChain
),
496 std::make_tuple(AnonFT
, StaticFT
, ExpectUnlinkedDeclChain
),
497 std::make_tuple(AnonFT
, AnonFT
, ExpectUnlinkedDeclChain
))) );
498 INSTANTIATE_TEST_SUITE_P(
499 ParameterizedTests
, ImportVariableTemplatesVisibility
,
501 DefaultTestValuesForRunOptions
,
503 std::make_tuple(ExternVT
, ExternVT
, ExpectLinkedDeclChain
),
504 std::make_tuple(ExternVT
, StaticVT
, ExpectUnlinkedDeclChain
),
505 std::make_tuple(ExternVT
, AnonVT
, ExpectUnlinkedDeclChain
),
506 std::make_tuple(StaticVT
, ExternVT
, ExpectUnlinkedDeclChain
),
507 std::make_tuple(StaticVT
, StaticVT
, ExpectUnlinkedDeclChain
),
508 std::make_tuple(StaticVT
, AnonVT
, ExpectUnlinkedDeclChain
),
509 std::make_tuple(AnonVT
, ExternVT
, ExpectUnlinkedDeclChain
),
510 std::make_tuple(AnonVT
, StaticVT
, ExpectUnlinkedDeclChain
),
511 std::make_tuple(AnonVT
, AnonVT
, ExpectUnlinkedDeclChain
))) );
512 INSTANTIATE_TEST_SUITE_P(
513 ParameterizedTests
, ImportClassTemplatesVisibility
,
515 DefaultTestValuesForRunOptions
,
516 ::testing::Values(std::make_tuple(ExternCT
, ExternCT
, ExpectLinkedDeclChain
),
517 std::make_tuple(ExternCT
, AnonCT
, ExpectUnlinkedDeclChain
),
518 std::make_tuple(AnonCT
, ExternCT
, ExpectUnlinkedDeclChain
),
519 std::make_tuple(AnonCT
, AnonCT
, ExpectUnlinkedDeclChain
))) );
520 } // end namespace ast_matchers
521 } // end namespace clang