Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20

Summary:
I think we would be better off with tests explicitly specifying the
language mode. Right now Lang_C means C99, but reads as "any C version",
or as "unspecified C version".

I also changed '-std=c++98' to '-std=c++03' because they are aliases (so
there is no difference in practice), because Clang implements C++03
rules in practice, and because 03 makes a nice sortable progression
between 03, 11, 14, 17, 20.

Reviewers: shafik, hlopko

Reviewed By: hlopko

Subscribers: jfb, martong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81000
This commit is contained in:
Dmitri Gribenko 2020-06-02 16:10:39 +02:00
parent aa3a85cdaa
commit d559185aae
9 changed files with 759 additions and 867 deletions

View File

@ -19,13 +19,13 @@
namespace clang {
enum TestLanguage {
Lang_C,
Lang_C89,
Lang_CXX,
Lang_C99,
Lang_CXX03,
Lang_CXX11,
Lang_CXX14,
Lang_CXX17,
Lang_CXX2a,
Lang_CXX20,
Lang_OpenCL,
Lang_OBJCXX
};

View File

@ -15,14 +15,14 @@ std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
std::vector<std::string> Args;
// Test with basic arguments.
switch (Lang) {
case Lang_C:
Args = {"-x", "c", "-std=c99"};
break;
case Lang_C89:
Args = {"-x", "c", "-std=c89"};
break;
case Lang_CXX:
Args = {"-std=c++98", "-frtti"};
case Lang_C99:
Args = {"-x", "c", "-std=c99"};
break;
case Lang_CXX03:
Args = {"-std=c++03", "-frtti"};
break;
case Lang_CXX11:
Args = {"-std=c++11", "-frtti"};
@ -33,8 +33,8 @@ std::vector<std::string> getCommandLineArgsForTesting(TestLanguage Lang) {
case Lang_CXX17:
Args = {"-std=c++17", "-frtti"};
break;
case Lang_CXX2a:
Args = {"-std=c++2a", "-frtti"};
case Lang_CXX20:
Args = {"-std=c++20", "-frtti"};
break;
case Lang_OBJCXX:
Args = {"-x", "objective-c++", "-frtti"};

View File

@ -180,11 +180,11 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
void
TypedTest_PrototypeShouldBeImportedAsAPrototypeWhenThereIsNoDefinition() {
Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX);
Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03);
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
ASSERT_FALSE(FromD->isThisDeclarationADefinition());
Decl *ImportedD = Import(FromD, Lang_CXX);
Decl *ImportedD = Import(FromD, Lang_CXX03);
Decl *ToTU = ImportedD->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
@ -197,11 +197,11 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_DefinitionShouldBeImportedAsADefinition() {
Decl *FromTU = getTuDecl(getDefinition(), Lang_CXX);
Decl *FromTU = getTuDecl(getDefinition(), Lang_CXX03);
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
ASSERT_TRUE(FromD->isThisDeclarationADefinition());
Decl *ImportedD = Import(FromD, Lang_CXX);
Decl *ImportedD = Import(FromD, Lang_CXX03);
Decl *ToTU = ImportedD->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 1u);
@ -213,14 +213,14 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_ImportPrototypeAfterImportedPrototype() {
Decl *FromTU = getTuDecl(getPrototype() + getPrototype(), Lang_CXX);
Decl *FromTU = getTuDecl(getPrototype() + getPrototype(), Lang_CXX03);
auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
auto *From1 = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
ASSERT_FALSE(From0->isThisDeclarationADefinition());
ASSERT_FALSE(From1->isThisDeclarationADefinition());
Decl *Imported0 = Import(From0, Lang_CXX);
Decl *Imported1 = Import(From1, Lang_CXX);
Decl *Imported0 = Import(From0, Lang_CXX03);
Decl *Imported1 = Import(From1, Lang_CXX03);
Decl *ToTU = Imported0->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
@ -235,14 +235,14 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_ImportDefinitionAfterImportedPrototype() {
Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX);
Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);
auto *FromProto = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
auto *FromDef = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
Decl *ImportedProto = Import(FromProto, Lang_CXX);
Decl *ImportedDef = Import(FromDef, Lang_CXX);
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
Decl *ToTU = ImportedProto->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
@ -257,14 +257,14 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_ImportPrototypeAfterImportedDefinition() {
Decl *FromTU = getTuDecl(getDefinition() + getPrototype(), Lang_CXX);
Decl *FromTU = getTuDecl(getDefinition() + getPrototype(), Lang_CXX03);
auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
auto *FromProto = LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
Decl *ImportedDef = Import(FromDef, Lang_CXX);
Decl *ImportedProto = Import(FromProto, Lang_CXX);
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
Decl *ToTU = ImportedDef->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
@ -279,15 +279,15 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_ImportPrototypes() {
Decl *FromTU0 = getTuDecl(getPrototype(), Lang_CXX, "input0.cc");
Decl *FromTU1 = getTuDecl(getPrototype(), Lang_CXX, "input1.cc");
Decl *FromTU0 = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
Decl *FromTU1 = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");
auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());
auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());
ASSERT_FALSE(From0->isThisDeclarationADefinition());
ASSERT_FALSE(From1->isThisDeclarationADefinition());
Decl *Imported0 = Import(From0, Lang_CXX);
Decl *Imported1 = Import(From1, Lang_CXX);
Decl *Imported0 = Import(From0, Lang_CXX03);
Decl *Imported1 = Import(From1, Lang_CXX03);
Decl *ToTU = Imported0->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<DeclTy>().match(ToTU, getPattern()), 2u);
@ -302,15 +302,15 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_ImportDefinitions() {
Decl *FromTU0 = getTuDecl(getDefinition(), Lang_CXX, "input0.cc");
Decl *FromTU1 = getTuDecl(getDefinition(), Lang_CXX, "input1.cc");
Decl *FromTU0 = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");
Decl *FromTU1 = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");
auto *From0 = FirstDeclMatcher<DeclTy>().match(FromTU0, getPattern());
auto *From1 = FirstDeclMatcher<DeclTy>().match(FromTU1, getPattern());
ASSERT_TRUE(From0->isThisDeclarationADefinition());
ASSERT_TRUE(From1->isThisDeclarationADefinition());
Decl *Imported0 = Import(From0, Lang_CXX);
Decl *Imported1 = Import(From1, Lang_CXX);
Decl *Imported0 = Import(From0, Lang_CXX03);
Decl *Imported1 = Import(From1, Lang_CXX03);
Decl *ToTU = Imported0->getTranslationUnitDecl();
EXPECT_EQ(Imported0, Imported1);
@ -324,16 +324,16 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_ImportDefinitionThenPrototype() {
Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX, "input0.cc");
Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX, "input1.cc");
Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input0.cc");
Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input1.cc");
auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());
auto *FromProto =
FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
Decl *ImportedDef = Import(FromDef, Lang_CXX);
Decl *ImportedProto = Import(FromProto, Lang_CXX);
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
Decl *ToTU = ImportedDef->getTranslationUnitDecl();
EXPECT_NE(ImportedDef, ImportedProto);
@ -349,16 +349,16 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_ImportPrototypeThenDefinition() {
Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX, "input0.cc");
Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX, "input1.cc");
Decl *FromTUProto = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
Decl *FromTUDef = getTuDecl(getDefinition(), Lang_CXX03, "input1.cc");
auto *FromProto =
FirstDeclMatcher<DeclTy>().match(FromTUProto, getPattern());
auto *FromDef = FirstDeclMatcher<DeclTy>().match(FromTUDef, getPattern());
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
ASSERT_FALSE(FromProto->isThisDeclarationADefinition());
Decl *ImportedProto = Import(FromProto, Lang_CXX);
Decl *ImportedDef = Import(FromDef, Lang_CXX);
Decl *ImportedProto = Import(FromProto, Lang_CXX03);
Decl *ImportedDef = Import(FromDef, Lang_CXX03);
Decl *ToTU = ImportedDef->getTranslationUnitDecl();
EXPECT_NE(ImportedDef, ImportedProto);
@ -374,12 +374,12 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
}
void TypedTest_WholeRedeclChainIsImportedAtOnce() {
Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX);
Decl *FromTU = getTuDecl(getPrototype() + getDefinition(), Lang_CXX03);
auto *FromD = // Definition
LastDeclMatcher<DeclTy>().match(FromTU, getPattern());
ASSERT_TRUE(FromD->isThisDeclarationADefinition());
Decl *ImportedD = Import(FromD, Lang_CXX);
Decl *ImportedD = Import(FromD, Lang_CXX03);
Decl *ToTU = ImportedD->getTranslationUnitDecl();
// The whole redecl chain is imported at once.
@ -389,15 +389,15 @@ struct RedeclChain : ASTImporterOptionSpecificTestBase {
void TypedTest_ImportPrototypeThenProtoAndDefinition() {
{
Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX, "input0.cc");
Decl *FromTU = getTuDecl(getPrototype(), Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
Import(FromD, Lang_CXX);
Import(FromD, Lang_CXX03);
}
{
Decl *FromTU =
getTuDecl(getPrototype() + getDefinition(), Lang_CXX, "input1.cc");
getTuDecl(getPrototype() + getDefinition(), Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<DeclTy>().match(FromTU, getPattern());
Import(FromD, Lang_CXX);
Import(FromD, Lang_CXX03);
}
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();

View File

@ -37,7 +37,7 @@ struct Function {
BindableMatcher<Decl> getPattern() {
return functionDecl(hasName("X"), unless(isImplicit()));
}
TestLanguage getLang() { return Lang_C; }
TestLanguage getLang() { return Lang_C99; }
};
struct Typedef {
@ -45,7 +45,7 @@ struct Typedef {
static constexpr auto *Definition = "typedef int X;";
static constexpr auto *ConflictingDefinition = "typedef double X;";
BindableMatcher<Decl> getPattern() { return typedefNameDecl(hasName("X")); }
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
struct TypedefAlias {
@ -61,7 +61,7 @@ struct Enum {
static constexpr auto *Definition = "enum X { a, b };";
static constexpr auto *ConflictingDefinition = "enum X { a, b, c };";
BindableMatcher<Decl> getPattern() { return enumDecl(hasName("X")); }
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
struct EnumClass {
@ -77,7 +77,7 @@ struct EnumConstant {
static constexpr auto *Definition = "enum E { X = 0 };";
static constexpr auto *ConflictingDefinition = "enum E { X = 1 };";
BindableMatcher<Decl> getPattern() { return enumConstantDecl(hasName("X")); }
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
struct Class {
@ -88,7 +88,7 @@ struct Class {
BindableMatcher<Decl> getPattern() {
return cxxRecordDecl(hasName("X"), unless(isImplicit()));
}
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
struct Variable {
@ -98,7 +98,7 @@ struct Variable {
static constexpr auto *Definition = "int X;";
static constexpr auto *ConflictingDefinition = "float X;";
BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); }
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
struct ClassTemplate {
@ -112,7 +112,7 @@ struct ClassTemplate {
BindableMatcher<Decl> getPattern() {
return classTemplateDecl(hasName("X"), unless(isImplicit()));
}
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
struct FunctionTemplate {
@ -133,7 +133,7 @@ struct FunctionTemplate {
}
static std::string getDef0() { return Definition0; }
static std::string getDef1() { return Definition1; }
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
static const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateDecl>
@ -175,7 +175,7 @@ struct ClassTemplateSpec {
BindableMatcher<Decl> getPattern() {
return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
}
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
// Function template specializations are all "full" specializations.
@ -208,7 +208,7 @@ struct FunctionTemplateSpec {
}
static std::string getDef0() { return Definition0; }
static std::string getDef1() { return Definition1; }
TestLanguage getLang() { return Lang_CXX; }
TestLanguage getLang() { return Lang_CXX03; }
};
static const internal::VariadicDynCastAllOfMatcher<

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ public:
testing::AssertionResult match(const std::string &Code,
const MatcherType &AMatcher) {
std::vector<std::string> Args;
return match(Code, AMatcher, Args, Lang_CXX);
return match(Code, AMatcher, Args, Lang_CXX03);
}
template <typename MatcherType>
@ -88,16 +88,16 @@ MatchVerifier<NodeType>::match(const std::string &Code,
StringRef FileName;
switch (L) {
case Lang_C:
Args.push_back("-std=c99");
FileName = "input.c";
break;
case Lang_C89:
Args.push_back("-std=c89");
FileName = "input.c";
break;
case Lang_CXX:
Args.push_back("-std=c++98");
case Lang_C99:
Args.push_back("-std=c99");
FileName = "input.c";
break;
case Lang_CXX03:
Args.push_back("-std=c++03");
FileName = "input.cc";
break;
case Lang_CXX11:
@ -112,8 +112,8 @@ MatchVerifier<NodeType>::match(const std::string &Code,
Args.push_back("-std=c++17");
FileName = "input.cc";
break;
case Lang_CXX2a:
Args.push_back("-std=c++2a");
case Lang_CXX20:
Args.push_back("-std=c++20");
FileName = "input.cc";
break;
case Lang_OpenCL:

View File

@ -82,13 +82,13 @@ TEST(LabelStmt, Range) {
TEST(ParmVarDecl, KNRLocation) {
LocationVerifier<ParmVarDecl> Verifier;
Verifier.expectLocation(1, 8);
EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C99));
}
TEST(ParmVarDecl, KNRRange) {
RangeVerifier<ParmVarDecl> Verifier;
Verifier.expectRange(1, 8, 1, 8);
EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C99));
}
TEST(CXXNewExpr, ArrayRange) {
@ -814,7 +814,7 @@ TEST(FunctionDecl, ExceptionSpecifications) {
std::vector<std::string> Args;
Args.push_back("-fms-extensions");
EXPECT_TRUE(Verifier.match("void f() throw(...);\n", loc(functionType()),
Args, Lang_CXX));
Args, Lang_CXX03));
Verifier.expectRange(1, 10, 1, 10);
EXPECT_TRUE(

View File

@ -101,41 +101,41 @@ struct StructuralEquivalenceTest : ::testing::Test {
};
TEST_F(StructuralEquivalenceTest, Int) {
auto Decls = makeNamedDecls("int foo;", "int foo;", Lang_CXX);
auto Decls = makeNamedDecls("int foo;", "int foo;", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(Decls));
}
TEST_F(StructuralEquivalenceTest, IntVsSignedInt) {
auto Decls = makeNamedDecls("int foo;", "signed int foo;", Lang_CXX);
auto Decls = makeNamedDecls("int foo;", "signed int foo;", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(Decls));
}
TEST_F(StructuralEquivalenceTest, Char) {
auto Decls = makeNamedDecls("char foo;", "char foo;", Lang_CXX);
auto Decls = makeNamedDecls("char foo;", "char foo;", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(Decls));
}
// This test is disabled for now.
// FIXME Whether this is equivalent is dependendant on the target.
TEST_F(StructuralEquivalenceTest, DISABLED_CharVsSignedChar) {
auto Decls = makeNamedDecls("char foo;", "signed char foo;", Lang_CXX);
auto Decls = makeNamedDecls("char foo;", "signed char foo;", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(Decls));
}
TEST_F(StructuralEquivalenceTest, ForwardRecordDecl) {
auto Decls = makeNamedDecls("struct foo;", "struct foo;", Lang_CXX);
auto Decls = makeNamedDecls("struct foo;", "struct foo;", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(Decls));
}
TEST_F(StructuralEquivalenceTest, IntVsSignedIntInStruct) {
auto Decls = makeNamedDecls("struct foo { int x; };",
"struct foo { signed int x; };", Lang_CXX);
"struct foo { signed int x; };", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(Decls));
}
TEST_F(StructuralEquivalenceTest, CharVsSignedCharInStruct) {
auto Decls = makeNamedDecls("struct foo { char x; };",
"struct foo { signed char x; };", Lang_CXX);
"struct foo { signed char x; };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(Decls));
}
@ -143,8 +143,7 @@ TEST_F(StructuralEquivalenceTest, IntVsSignedIntTemplateSpec) {
auto Decls = makeDecls<ClassTemplateSpecializationDecl>(
R"(template <class T> struct foo; template<> struct foo<int>{};)",
R"(template <class T> struct foo; template<> struct foo<signed int>{};)",
Lang_CXX,
classTemplateSpecializationDecl());
Lang_CXX03, classTemplateSpecializationDecl());
auto Spec0 = get<0>(Decls);
auto Spec1 = get<1>(Decls);
EXPECT_TRUE(testStructuralMatch(Spec0, Spec1));
@ -154,8 +153,7 @@ TEST_F(StructuralEquivalenceTest, CharVsSignedCharTemplateSpec) {
auto Decls = makeDecls<ClassTemplateSpecializationDecl>(
R"(template <class T> struct foo; template<> struct foo<char>{};)",
R"(template <class T> struct foo; template<> struct foo<signed char>{};)",
Lang_CXX,
classTemplateSpecializationDecl());
Lang_CXX03, classTemplateSpecializationDecl());
auto Spec0 = get<0>(Decls);
auto Spec1 = get<1>(Decls);
EXPECT_FALSE(testStructuralMatch(Spec0, Spec1));
@ -173,8 +171,7 @@ TEST_F(StructuralEquivalenceTest, CharVsSignedCharTemplateSpecWithInheritance) {
template <class T> struct foo;
template<> struct foo<signed char> : true_type {};
)",
Lang_CXX,
classTemplateSpecializationDecl());
Lang_CXX03, classTemplateSpecializationDecl());
EXPECT_FALSE(testStructuralMatch(Decls));
}
@ -192,7 +189,7 @@ TEST_F(StructuralEquivalenceTest, DISABLED_WrongOrderInNamespace) {
}
void foo(NS::Derived &);
)";
auto Decls = makeNamedDecls(Code, Code, Lang_CXX);
auto Decls = makeNamedDecls(Code, Code, Lang_CXX03);
NamespaceDecl *NS =
LastDeclMatcher<NamespaceDecl>().match(get<1>(Decls), namespaceDecl());
@ -208,7 +205,7 @@ TEST_F(StructuralEquivalenceTest, DISABLED_WrongOrderInNamespace) {
TEST_F(StructuralEquivalenceTest, WrongOrderOfFieldsInClass) {
auto Code = "class X { int a; int b; };";
auto Decls = makeNamedDecls(Code, Code, Lang_CXX, "X");
auto Decls = makeNamedDecls(Code, Code, Lang_CXX03, "X");
CXXRecordDecl *RD = FirstDeclMatcher<CXXRecordDecl>().match(
get<1>(Decls), cxxRecordDecl(hasName("X")));
@ -226,56 +223,48 @@ struct StructuralEquivalenceFunctionTest : StructuralEquivalenceTest {
};
TEST_F(StructuralEquivalenceFunctionTest, TemplateVsNonTemplate) {
auto t = makeNamedDecls(
"void foo();",
"template<class T> void foo();",
Lang_CXX);
auto t = makeNamedDecls("void foo();", "template<class T> void foo();",
Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, DifferentOperators) {
auto t = makeDecls<FunctionDecl>(
"struct X{}; bool operator<(X, X);",
"struct X{}; bool operator==(X, X);", Lang_CXX,
functionDecl(hasOverloadedOperatorName("<")),
"struct X{}; bool operator<(X, X);", "struct X{}; bool operator==(X, X);",
Lang_CXX03, functionDecl(hasOverloadedOperatorName("<")),
functionDecl(hasOverloadedOperatorName("==")));
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, SameOperators) {
auto t = makeDecls<FunctionDecl>(
"struct X{}; bool operator<(X, X);",
"struct X{}; bool operator<(X, X);", Lang_CXX,
functionDecl(hasOverloadedOperatorName("<")),
"struct X{}; bool operator<(X, X);", "struct X{}; bool operator<(X, X);",
Lang_CXX03, functionDecl(hasOverloadedOperatorName("<")),
functionDecl(hasOverloadedOperatorName("<")));
EXPECT_TRUE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, CtorVsDtor) {
auto t = makeDecls<FunctionDecl>(
"struct X{ X(); };",
"struct X{ ~X(); };", Lang_CXX,
cxxConstructorDecl(),
cxxDestructorDecl());
auto t = makeDecls<FunctionDecl>("struct X{ X(); };", "struct X{ ~X(); };",
Lang_CXX03, cxxConstructorDecl(),
cxxDestructorDecl());
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, ParamConstWithRef) {
auto t = makeNamedDecls("void foo(int&);",
"void foo(const int&);", Lang_CXX);
auto t =
makeNamedDecls("void foo(int&);", "void foo(const int&);", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, ParamConstSimple) {
auto t = makeNamedDecls("void foo(int);",
"void foo(const int);", Lang_CXX);
auto t = makeNamedDecls("void foo(int);", "void foo(const int);", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(t));
// consider this OK
}
TEST_F(StructuralEquivalenceFunctionTest, Throw) {
auto t = makeNamedDecls("void foo();",
"void foo() throw();", Lang_CXX);
auto t = makeNamedDecls("void foo();", "void foo() throw();", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
@ -328,14 +317,12 @@ TEST_F(StructuralEquivalenceFunctionTest, NoexceptVsNoexceptTrue) {
}
TEST_F(StructuralEquivalenceFunctionTest, ReturnType) {
auto t = makeNamedDecls("char foo();",
"int foo();", Lang_CXX);
auto t = makeNamedDecls("char foo();", "int foo();", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, ReturnConst) {
auto t = makeNamedDecls("char foo();",
"const char foo();", Lang_CXX);
auto t = makeNamedDecls("char foo();", "const char foo();", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
@ -346,40 +333,33 @@ TEST_F(StructuralEquivalenceFunctionTest, ReturnRef) {
}
TEST_F(StructuralEquivalenceFunctionTest, ParamCount) {
auto t = makeNamedDecls("void foo(int);",
"void foo(int, int);", Lang_CXX);
auto t = makeNamedDecls("void foo(int);", "void foo(int, int);", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, ParamType) {
auto t = makeNamedDecls("void foo(int);",
"void foo(char);", Lang_CXX);
auto t = makeNamedDecls("void foo(int);", "void foo(char);", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, ParamName) {
auto t = makeNamedDecls("void foo(int a);",
"void foo(int b);", Lang_CXX);
auto t = makeNamedDecls("void foo(int a);", "void foo(int b);", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, Variadic) {
auto t = makeNamedDecls("void foo(int x...);",
"void foo(int x);", Lang_CXX);
auto t =
makeNamedDecls("void foo(int x...);", "void foo(int x);", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, ParamPtr) {
auto t = makeNamedDecls("void foo(int *);",
"void foo(int);", Lang_CXX);
auto t = makeNamedDecls("void foo(int *);", "void foo(int);", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceFunctionTest, NameInParen) {
auto t = makeNamedDecls(
"void ((foo))();",
"void foo();",
Lang_CXX);
auto t = makeNamedDecls("void ((foo))();", "void foo();", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(t));
}
@ -400,10 +380,8 @@ TEST_F(StructuralEquivalenceFunctionTest, NameInParenWithConst) {
}
TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentNoreturnAttr) {
auto t = makeNamedDecls(
"__attribute__((noreturn)) void foo();",
" void foo();",
Lang_C);
auto t = makeNamedDecls("__attribute__((noreturn)) void foo();",
" void foo();", Lang_C99);
EXPECT_TRUE(testStructuralMatch(t));
}
@ -413,10 +391,8 @@ TEST_F(StructuralEquivalenceFunctionTest,
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArch() !=
llvm::Triple::x86_64)
return;
auto t = makeNamedDecls(
"__attribute__((preserve_all)) void foo();",
"__attribute__((ms_abi)) void foo();",
Lang_C);
auto t = makeNamedDecls("__attribute__((preserve_all)) void foo();",
"__attribute__((ms_abi)) void foo();", Lang_C99);
EXPECT_FALSE(testStructuralMatch(t));
}
@ -426,8 +402,7 @@ TEST_F(StructuralEquivalenceFunctionTest, FunctionsWithDifferentSavedRegsAttr) {
return;
auto t = makeNamedDecls(
"__attribute__((no_caller_saved_registers)) void foo();",
" void foo();",
Lang_C);
" void foo();", Lang_C99);
EXPECT_FALSE(testStructuralMatch(t));
}
@ -435,35 +410,35 @@ struct StructuralEquivalenceCXXMethodTest : StructuralEquivalenceTest {
};
TEST_F(StructuralEquivalenceCXXMethodTest, Virtual) {
auto t = makeDecls<CXXMethodDecl>(
"struct X { void foo(); };",
"struct X { virtual void foo(); };", Lang_CXX,
cxxMethodDecl(hasName("foo")));
auto t = makeDecls<CXXMethodDecl>("struct X { void foo(); };",
"struct X { virtual void foo(); };",
Lang_CXX03, cxxMethodDecl(hasName("foo")));
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceCXXMethodTest, Pure) {
auto t = makeNamedDecls("struct X { virtual void foo(); };",
"struct X { virtual void foo() = 0; };", Lang_CXX);
"struct X { virtual void foo() = 0; };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceCXXMethodTest, DISABLED_Final) {
// The final-ness is not checked yet.
auto t = makeNamedDecls("struct X { virtual void foo(); };",
"struct X { virtual void foo() final; };", Lang_CXX);
auto t =
makeNamedDecls("struct X { virtual void foo(); };",
"struct X { virtual void foo() final; };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceCXXMethodTest, Const) {
auto t = makeNamedDecls("struct X { void foo(); };",
"struct X { void foo() const; };", Lang_CXX);
"struct X { void foo() const; };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceCXXMethodTest, Static) {
auto t = makeNamedDecls("struct X { void foo(); };",
"struct X { static void foo(); };", Lang_CXX);
"struct X { static void foo(); };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
@ -480,10 +455,9 @@ TEST_F(StructuralEquivalenceCXXMethodTest, Ref2) {
}
TEST_F(StructuralEquivalenceCXXMethodTest, AccessSpecifier) {
auto t = makeDecls<CXXMethodDecl>(
"struct X { public: void foo(); };",
"struct X { private: void foo(); };", Lang_CXX,
cxxMethodDecl(hasName("foo")));
auto t = makeDecls<CXXMethodDecl>("struct X { public: void foo(); };",
"struct X { private: void foo(); };",
Lang_CXX03, cxxMethodDecl(hasName("foo")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -494,15 +468,15 @@ TEST_F(StructuralEquivalenceCXXMethodTest, Delete) {
}
TEST_F(StructuralEquivalenceCXXMethodTest, Constructor) {
auto t = makeDecls<FunctionDecl>(
"void foo();", "struct foo { foo(); };", Lang_CXX,
functionDecl(hasName("foo")), cxxConstructorDecl(hasName("foo")));
auto t = makeDecls<FunctionDecl>("void foo();", "struct foo { foo(); };",
Lang_CXX03, functionDecl(hasName("foo")),
cxxConstructorDecl(hasName("foo")));
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceCXXMethodTest, ConstructorParam) {
auto t = makeDecls<CXXConstructorDecl>("struct X { X(); };",
"struct X { X(int); };", Lang_CXX,
"struct X { X(int); };", Lang_CXX03,
cxxConstructorDecl(hasName("X")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -532,19 +506,18 @@ TEST_F(StructuralEquivalenceCXXMethodTest, Conversion) {
}
TEST_F(StructuralEquivalenceCXXMethodTest, Operator) {
auto t = makeDecls<FunctionDecl>(
"struct X { int operator +(int); };",
"struct X { int operator -(int); };", Lang_CXX,
functionDecl(hasOverloadedOperatorName("+")),
functionDecl(hasOverloadedOperatorName("-")));
auto t =
makeDecls<FunctionDecl>("struct X { int operator +(int); };",
"struct X { int operator -(int); };", Lang_CXX03,
functionDecl(hasOverloadedOperatorName("+")),
functionDecl(hasOverloadedOperatorName("-")));
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceCXXMethodTest, OutOfClass1) {
auto t = makeDecls<FunctionDecl>(
"struct X { virtual void f(); }; void X::f() { }",
"struct X { virtual void f() { }; };",
Lang_CXX,
"struct X { virtual void f() { }; };", Lang_CXX03,
functionDecl(allOf(hasName("f"), isDefinition())));
EXPECT_TRUE(testStructuralMatch(t));
}
@ -552,8 +525,7 @@ TEST_F(StructuralEquivalenceCXXMethodTest, OutOfClass1) {
TEST_F(StructuralEquivalenceCXXMethodTest, OutOfClass2) {
auto t = makeDecls<FunctionDecl>(
"struct X { virtual void f(); }; void X::f() { }",
"struct X { void f(); }; void X::f() { }",
Lang_CXX,
"struct X { void f(); }; void X::f() { }", Lang_CXX03,
functionDecl(allOf(hasName("f"), isDefinition())));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -567,54 +539,43 @@ struct StructuralEquivalenceRecordTest : StructuralEquivalenceTest {
};
TEST_F(StructuralEquivalenceRecordTest, Name) {
auto t = makeDecls<CXXRecordDecl>(
"struct A{ };",
"struct B{ };",
Lang_CXX,
cxxRecordDecl(hasName("A")),
cxxRecordDecl(hasName("B")));
auto t = makeDecls<CXXRecordDecl>("struct A{ };", "struct B{ };", Lang_CXX03,
cxxRecordDecl(hasName("A")),
cxxRecordDecl(hasName("B")));
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceRecordTest, Fields) {
auto t = makeNamedDecls(
"struct foo{ int x; };",
"struct foo{ char x; };",
Lang_CXX);
auto t = makeNamedDecls("struct foo{ int x; };", "struct foo{ char x; };",
Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceRecordTest, DISABLED_Methods) {
// Currently, methods of a class are not checked at class equivalence.
auto t = makeNamedDecls(
"struct foo{ int x(); };",
"struct foo{ char x(); };",
Lang_CXX);
auto t = makeNamedDecls("struct foo{ int x(); };", "struct foo{ char x(); };",
Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceRecordTest, Bases) {
auto t = makeNamedDecls(
"struct A{ }; struct foo: A { };",
"struct B{ }; struct foo: B { };",
Lang_CXX);
auto t = makeNamedDecls("struct A{ }; struct foo: A { };",
"struct B{ }; struct foo: B { };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceRecordTest, InheritanceVirtual) {
auto t = makeNamedDecls(
"struct A{ }; struct foo: A { };",
"struct A{ }; struct foo: virtual A { };",
Lang_CXX);
auto t =
makeNamedDecls("struct A{ }; struct foo: A { };",
"struct A{ }; struct foo: virtual A { };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceRecordTest, DISABLED_InheritanceType) {
// Access specifier in inheritance is not checked yet.
auto t = makeNamedDecls(
"struct A{ }; struct foo: public A { };",
"struct A{ }; struct foo: private A { };",
Lang_CXX);
auto t =
makeNamedDecls("struct A{ }; struct foo: public A { };",
"struct A{ }; struct foo: private A { };", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
@ -627,7 +588,7 @@ TEST_F(StructuralEquivalenceRecordTest, Match) {
int a;
};
)";
auto t = makeNamedDecls(Code, Code, Lang_CXX);
auto t = makeNamedDecls(Code, Code, Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(t));
}
@ -643,7 +604,7 @@ TEST_F(StructuralEquivalenceRecordTest, UnnamedRecordsShouldBeInequivalent) {
} entry1;
};
)",
"", Lang_C);
"", Lang_C99);
auto *TU = get<0>(t);
auto *Entry0 =
FirstDeclMatcher<FieldDecl>().match(TU, fieldDecl(hasName("entry0")));
@ -670,7 +631,7 @@ TEST_F(StructuralEquivalenceRecordTest, AnonymousRecordsShouldBeInequivalent) {
};
};
)",
"", Lang_C);
"", Lang_C99);
auto *TU = get<0>(t);
auto *A = FirstDeclMatcher<IndirectFieldDecl>().match(
TU, indirectFieldDecl(hasName("a")));
@ -702,7 +663,7 @@ TEST_F(StructuralEquivalenceRecordTest,
struct { int a; };
};
)",
Lang_C);
Lang_C99);
auto *TU = get<0>(t);
auto *A = FirstDeclMatcher<IndirectFieldDecl>().match(
@ -742,7 +703,7 @@ TEST_F(StructuralEquivalenceRecordTest,
} entry1;
};
)";
auto t = makeTuDecls(Code, Code, Lang_C);
auto t = makeTuDecls(Code, Code, Lang_C99);
auto *FromTU = get<0>(t);
auto *Entry1 =
@ -766,11 +727,9 @@ TEST_F(StructuralEquivalenceRecordTest,
}
TEST_F(StructuralEquivalenceRecordTest, TemplateVsNonTemplate) {
auto t = makeDecls<CXXRecordDecl>(
"struct A { };",
"template<class T> struct A { };",
Lang_CXX,
cxxRecordDecl(hasName("A")));
auto t = makeDecls<CXXRecordDecl>("struct A { };",
"template<class T> struct A { };",
Lang_CXX03, cxxRecordDecl(hasName("A")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -853,16 +812,15 @@ TEST_F(StructuralEquivalenceLambdaTest, LambdaClassesWithEqFields) {
}
TEST_F(StructuralEquivalenceTest, CompareSameDeclWithMultiple) {
auto t = makeNamedDecls(
"struct A{ }; struct B{ }; void foo(A a, A b);",
"struct A{ }; struct B{ }; void foo(A a, B b);",
Lang_CXX);
auto t = makeNamedDecls("struct A{ }; struct B{ }; void foo(A a, A b);",
"struct A{ }; struct B{ }; void foo(A a, B b);",
Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceTest, ExplicitBoolDifferent) {
auto Decls = makeNamedDecls("struct foo {explicit(false) foo(int);};",
"struct foo {explicit(true) foo(int);};", Lang_CXX2a);
"struct foo {explicit(true) foo(int);};", Lang_CXX20);
CXXConstructorDecl *First = FirstDeclMatcher<CXXConstructorDecl>().match(
get<0>(Decls), cxxConstructorDecl(hasName("foo")));
CXXConstructorDecl *Second = FirstDeclMatcher<CXXConstructorDecl>().match(
@ -872,7 +830,7 @@ TEST_F(StructuralEquivalenceTest, ExplicitBoolDifferent) {
TEST_F(StructuralEquivalenceTest, ExplicitBoolSame) {
auto Decls = makeNamedDecls("struct foo {explicit(true) foo(int);};",
"struct foo {explicit(true) foo(int);};", Lang_CXX2a);
"struct foo {explicit(true) foo(int);};", Lang_CXX20);
CXXConstructorDecl *First = FirstDeclMatcher<CXXConstructorDecl>().match(
get<0>(Decls), cxxConstructorDecl(hasName("foo")));
CXXConstructorDecl *Second = FirstDeclMatcher<CXXConstructorDecl>().match(
@ -911,25 +869,26 @@ struct StructuralEquivalenceTemplateTest : StructuralEquivalenceTest {};
TEST_F(StructuralEquivalenceTemplateTest, ExactlySameTemplates) {
auto t = makeNamedDecls("template <class T> struct foo;",
"template <class T> struct foo;", Lang_CXX);
"template <class T> struct foo;", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgName) {
auto t = makeNamedDecls("template <class T> struct foo;",
"template <class U> struct foo;", Lang_CXX);
"template <class U> struct foo;", Lang_CXX03);
EXPECT_TRUE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgKind) {
auto t = makeNamedDecls("template <class T> struct foo;",
"template <int T> struct foo;", Lang_CXX);
"template <int T> struct foo;", Lang_CXX03);
EXPECT_FALSE(testStructuralMatch(t));
}
TEST_F(StructuralEquivalenceTemplateTest, ExplicitBoolSame) {
auto Decls = makeNamedDecls("template <bool b> struct foo {explicit(b) foo(int);};",
"template <bool b> struct foo {explicit(b) foo(int);};", Lang_CXX2a);
auto Decls = makeNamedDecls(
"template <bool b> struct foo {explicit(b) foo(int);};",
"template <bool b> struct foo {explicit(b) foo(int);};", Lang_CXX20);
CXXConstructorDecl *First = FirstDeclMatcher<CXXConstructorDecl>().match(
get<0>(Decls), cxxConstructorDecl(hasName("foo<b>")));
CXXConstructorDecl *Second = FirstDeclMatcher<CXXConstructorDecl>().match(
@ -938,8 +897,9 @@ TEST_F(StructuralEquivalenceTemplateTest, ExplicitBoolSame) {
}
TEST_F(StructuralEquivalenceTemplateTest, ExplicitBoolDifference) {
auto Decls = makeNamedDecls("template <bool b> struct foo {explicit(b) foo(int);};",
"template <bool b> struct foo {explicit(!b) foo(int);};", Lang_CXX2a);
auto Decls = makeNamedDecls(
"template <bool b> struct foo {explicit(b) foo(int);};",
"template <bool b> struct foo {explicit(!b) foo(int);};", Lang_CXX20);
CXXConstructorDecl *First = FirstDeclMatcher<CXXConstructorDecl>().match(
get<0>(Decls), cxxConstructorDecl(hasName("foo<b>")));
CXXConstructorDecl *Second = FirstDeclMatcher<CXXConstructorDecl>().match(
@ -973,7 +933,7 @@ template <template <typename PP1> class P1> class Templ {
// Instantiate with substitution Arg into P1.
template class Templ <Arg>;
)",
Lang_CXX, classTemplateSpecializationDecl(hasName("Primary")));
Lang_CXX03, classTemplateSpecializationDecl(hasName("Primary")));
EXPECT_TRUE(testStructuralMatch(t));
}
@ -1004,7 +964,7 @@ template <template <typename PP1> class P1> class Templ {
// Instantiate with substitution Arg into P1.
template class Templ <Arg>;
)",
Lang_CXX, classTemplateSpecializationDecl(hasName("Primary")));
Lang_CXX03, classTemplateSpecializationDecl(hasName("Primary")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -1112,7 +1072,7 @@ TEST_F(StructuralEquivalenceDependentTemplateArgsTest,
void f();
};
)",
Lang_CXX,
Lang_CXX03,
functionTemplateDecl(hasName("f")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -1141,7 +1101,7 @@ TEST_F(StructuralEquivalenceDependentTemplateArgsTest,
void f();
};
)",
Lang_CXX,
Lang_CXX03,
functionTemplateDecl(hasName("f")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -1167,8 +1127,7 @@ TEST_F(
// Explicit instantiation with UNqualified name.
template struct Primary<Arg>;
)",
Lang_CXX,
classTemplateSpecializationDecl(hasName("Primary")));
Lang_CXX03, classTemplateSpecializationDecl(hasName("Primary")));
EXPECT_TRUE(testStructuralMatch(t));
}
@ -1194,8 +1153,7 @@ TEST_F(
// Explicit instantiation with UNqualified name.
template struct Primary<Arg>;
)",
Lang_CXX,
classTemplateSpecializationDecl(hasName("Primary")));
Lang_CXX03, classTemplateSpecializationDecl(hasName("Primary")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -1220,8 +1178,7 @@ TEST_F(
// Explicit instantiation with UNqualified name.
template struct Primary<Arg>;
)",
Lang_CXX,
classTemplateSpecializationDecl(hasName("Primary")));
Lang_CXX03, classTemplateSpecializationDecl(hasName("Primary")));
EXPECT_TRUE(testStructuralMatch(t));
}
@ -1247,8 +1204,7 @@ TEST_F(
// Explicit instantiation with UNqualified name.
template struct Primary<Arg>;
)",
Lang_CXX,
classTemplateSpecializationDecl(hasName("Primary")));
Lang_CXX03, classTemplateSpecializationDecl(hasName("Primary")));
EXPECT_FALSE(testStructuralMatch(t));
}
@ -1272,8 +1228,7 @@ TEST_F(
template struct Primary<Arg>;
}
)",
Lang_CXX,
classTemplateSpecializationDecl(hasName("Primary")));
Lang_CXX03, classTemplateSpecializationDecl(hasName("Primary")));
EXPECT_FALSE(testStructuralMatch(t));
}
struct StructuralEquivalenceCacheTest : public StructuralEquivalenceTest {
@ -1306,7 +1261,7 @@ TEST_F(StructuralEquivalenceCacheTest, SimpleNonEq) {
class B {};
void x(A, B);
)",
Lang_CXX);
Lang_CXX03);
StructuralEquivalenceContext Ctx(
get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(),
@ -1343,7 +1298,7 @@ TEST_F(StructuralEquivalenceCacheTest, SpecialNonEq) {
friend void y(B *);
};
)",
Lang_CXX);
Lang_CXX03);
StructuralEquivalenceContext Ctx(
get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(),
@ -1382,7 +1337,7 @@ TEST_F(StructuralEquivalenceCacheTest, Cycle) {
friend void x(A *);
};
)",
Lang_CXX);
Lang_CXX03);
StructuralEquivalenceContext Ctx(
get<0>(TU)->getASTContext(), get<1>(TU)->getASTContext(),

View File

@ -52,14 +52,14 @@ struct TestClangConfig {
std::string Target;
bool isCXX() const {
return Language == Lang_CXX || Language == Lang_CXX11 ||
return Language == Lang_CXX03 || Language == Lang_CXX11 ||
Language == Lang_CXX14 || Language == Lang_CXX17 ||
Language == Lang_CXX2a;
Language == Lang_CXX20;
}
bool isCXX11OrLater() const {
return Language == Lang_CXX11 || Language == Lang_CXX14 ||
Language == Lang_CXX17 || Language == Lang_CXX2a;
Language == Lang_CXX17 || Language == Lang_CXX20;
}
bool hasDelayedTemplateParsing() const {
@ -88,8 +88,8 @@ struct TestClangConfig {
static std::vector<TestClangConfig> &allConfigs() {
static std::vector<TestClangConfig> all_configs = []() {
std::vector<TestClangConfig> all_configs;
for (TestLanguage lang : {Lang_C, Lang_C89, Lang_CXX, Lang_CXX11,
Lang_CXX14, Lang_CXX17, Lang_CXX2a}) {
for (TestLanguage lang : {Lang_C89, Lang_C99, Lang_CXX03, Lang_CXX11,
Lang_CXX14, Lang_CXX17, Lang_CXX20}) {
TestClangConfig config;
config.Language = lang;
config.Target = "x86_64-pc-linux-gnu";