[clang] d559185 - Renamed Lang_C to Lang_C99, Lang_CXX to Lang_CXX03, and 2a to 20
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 2 07:34:36 PDT 2020
Author: Dmitri Gribenko
Date: 2020-06-02T16:31:20+02:00
New Revision: d559185aaebeb66456edb63b47da5a2f67a0a5e2
URL: https://github.com/llvm/llvm-project/commit/d559185aaebeb66456edb63b47da5a2f67a0a5e2
DIFF: https://github.com/llvm/llvm-project/commit/d559185aaebeb66456edb63b47da5a2f67a0a5e2.diff
LOG: 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
Added:
Modified:
clang/include/clang/Testing/CommandLineArgs.h
clang/lib/Testing/CommandLineArgs.cpp
clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
clang/unittests/AST/ASTImporterODRStrategiesTest.cpp
clang/unittests/AST/ASTImporterTest.cpp
clang/unittests/AST/MatchVerifier.h
clang/unittests/AST/SourceLocationTest.cpp
clang/unittests/AST/StructuralEquivalenceTest.cpp
clang/unittests/Tooling/Syntax/TreeTest.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Testing/CommandLineArgs.h b/clang/include/clang/Testing/CommandLineArgs.h
index 0d2267f63ac5..432a112b2e15 100644
--- a/clang/include/clang/Testing/CommandLineArgs.h
+++ b/clang/include/clang/Testing/CommandLineArgs.h
@@ -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
};
diff --git a/clang/lib/Testing/CommandLineArgs.cpp b/clang/lib/Testing/CommandLineArgs.cpp
index 58a61dade2ea..1d12187494be 100644
--- a/clang/lib/Testing/CommandLineArgs.cpp
+++ b/clang/lib/Testing/CommandLineArgs.cpp
@@ -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"};
diff --git a/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp b/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
index 944256e857c7..44930b1043e4 100644
--- a/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
+++ b/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
@@ -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();
diff --git a/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp b/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp
index 9ae27a08bc76..10cafe5bc634 100644
--- a/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp
+++ b/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp
@@ -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<
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 5e70d28f884d..57825560ceb7 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -264,7 +264,7 @@ struct ImportFixedPointExpr : ImportExpr {};
struct CanonicalRedeclChain : ASTImporterOptionSpecificTestBase {};
TEST_P(CanonicalRedeclChain, ShouldBeConsequentWithMatchers) {
- Decl *FromTU = getTuDecl("void f();", Lang_CXX);
+ Decl *FromTU = getTuDecl("void f();", Lang_CXX03);
auto Pattern = functionDecl(hasName("f"));
auto *D0 = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
@@ -274,7 +274,7 @@ TEST_P(CanonicalRedeclChain, ShouldBeConsequentWithMatchers) {
}
TEST_P(CanonicalRedeclChain, ShouldBeConsequentWithMatchers2) {
- Decl *FromTU = getTuDecl("void f(); void f(); void f();", Lang_CXX);
+ Decl *FromTU = getTuDecl("void f(); void f(); void f();", Lang_CXX03);
auto Pattern = functionDecl(hasName("f"));
auto *D0 = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
auto *D2 = LastDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
@@ -288,7 +288,7 @@ TEST_P(CanonicalRedeclChain, ShouldBeConsequentWithMatchers2) {
}
TEST_P(CanonicalRedeclChain, ShouldBeSameForAllDeclInTheChain) {
- Decl *FromTU = getTuDecl("void f(); void f(); void f();", Lang_CXX);
+ Decl *FromTU = getTuDecl("void f(); void f(); void f();", Lang_CXX03);
auto Pattern = functionDecl(hasName("f"));
auto *D0 = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
auto *D2 = LastDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
@@ -341,8 +341,8 @@ struct RedirectingImporterTest : ASTImporterOptionSpecificTestBase {
TEST_P(RedirectingImporterTest, InterceptImport) {
Decl *From, *To;
std::tie(From, To) =
- getImportedDecl("class shouldNotBeImported {};", Lang_CXX,
- "class realDecl {};", Lang_CXX, "shouldNotBeImported");
+ getImportedDecl("class shouldNotBeImported {};", Lang_CXX03,
+ "class realDecl {};", Lang_CXX03, "shouldNotBeImported");
auto *Imported = cast<CXXRecordDecl>(To);
EXPECT_EQ(Imported->getQualifiedNameAsString(), "realDecl");
@@ -361,7 +361,7 @@ TEST_P(RedirectingImporterTest, InterceptIndirectImport) {
std::tie(From, To) =
getImportedDecl("class shouldNotBeImported {};"
"class F { shouldNotBeImported f; };",
- Lang_CXX, "class realDecl {};", Lang_CXX, "F");
+ Lang_CXX03, "class realDecl {};", Lang_CXX03, "F");
// Make sure our ASTImporter prevented the importing of the decl.
auto *ToTU = To->getTranslationUnitDecl();
@@ -375,7 +375,7 @@ struct ImportPath : ASTImporterOptionSpecificTestBase {
Decl *FromTU;
FunctionDecl *D0, *D1, *D2;
ImportPath() {
- FromTU = getTuDecl("void f(); void f(); void f();", Lang_CXX);
+ FromTU = getTuDecl("void f(); void f(); void f();", Lang_CXX03);
auto Pattern = functionDecl(hasName("f"));
D0 = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
D2 = LastDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
@@ -473,21 +473,18 @@ TEST_P(ImportPath, CycleAfterCycle) {
TEST_P(ImportExpr, ImportStringLiteral) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() { (void)\"foo\"; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- stringLiteral(hasType(asString("const char [4]"))))));
- testImport(
- "void declToImport() { (void)L\"foo\"; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- stringLiteral(hasType(asString("const wchar_t [4]"))))));
- testImport(
- "void declToImport() { (void) \"foo\" \"bar\"; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- stringLiteral(hasType(asString("const char [7]"))))));
+ testImport("void declToImport() { (void)\"foo\"; }", Lang_CXX03, "",
+ Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(
+ stringLiteral(hasType(asString("const char [4]"))))));
+ testImport("void declToImport() { (void)L\"foo\"; }", Lang_CXX03, "",
+ Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(
+ stringLiteral(hasType(asString("const wchar_t [4]"))))));
+ testImport("void declToImport() { (void) \"foo\" \"bar\"; }", Lang_CXX03, "",
+ Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(
+ stringLiteral(hasType(asString("const char [7]"))))));
}
TEST_P(ImportExpr, ImportChooseExpr) {
@@ -495,18 +492,16 @@ TEST_P(ImportExpr, ImportChooseExpr) {
// This case tests C code that is not condition-dependent and has a true
// condition.
- testImport(
- "void declToImport() { (void)__builtin_choose_expr(1, 2, 3); }",
- Lang_C, "", Lang_C, Verifier,
- functionDecl(hasDescendant(chooseExpr())));
+ testImport("void declToImport() { (void)__builtin_choose_expr(1, 2, 3); }",
+ Lang_C99, "", Lang_C99, Verifier,
+ functionDecl(hasDescendant(chooseExpr())));
}
TEST_P(ImportExpr, ImportGNUNullExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() { (void)__null; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(gnuNullExpr(hasType(isInteger())))));
+ testImport("void declToImport() { (void)__null; }", Lang_CXX03, "",
+ Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(gnuNullExpr(hasType(isInteger())))));
}
TEST_P(ImportExpr, ImportCXXNullPtrLiteralExpr) {
@@ -520,23 +515,21 @@ TEST_P(ImportExpr, ImportCXXNullPtrLiteralExpr) {
TEST_P(ImportExpr, ImportFloatinglLiteralExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() { (void)1.0; }",
- Lang_C, "", Lang_C, Verifier,
- functionDecl(hasDescendant(
- floatLiteral(equals(1.0), hasType(asString("double"))))));
- testImport(
- "void declToImport() { (void)1.0e-5f; }",
- Lang_C, "", Lang_C, Verifier,
- functionDecl(hasDescendant(
- floatLiteral(equals(1.0e-5f), hasType(asString("float"))))));
+ testImport("void declToImport() { (void)1.0; }", Lang_C99, "", Lang_C99,
+ Verifier,
+ functionDecl(hasDescendant(
+ floatLiteral(equals(1.0), hasType(asString("double"))))));
+ testImport("void declToImport() { (void)1.0e-5f; }", Lang_C99, "", Lang_C99,
+ Verifier,
+ functionDecl(hasDescendant(
+ floatLiteral(equals(1.0e-5f), hasType(asString("float"))))));
}
TEST_P(ImportFixedPointExpr, ImportFixedPointerLiteralExpr) {
MatchVerifier<Decl> Verifier;
- testImport("void declToImport() { (void)1.0k; }", Lang_C, "", Lang_C,
+ testImport("void declToImport() { (void)1.0k; }", Lang_C99, "", Lang_C99,
Verifier, functionDecl(hasDescendant(fixedPointLiteral())));
- testImport("void declToImport() { (void)0.75r; }", Lang_C, "", Lang_C,
+ testImport("void declToImport() { (void)0.75r; }", Lang_C99, "", Lang_C99,
Verifier, functionDecl(hasDescendant(fixedPointLiteral())));
}
@@ -550,60 +543,47 @@ TEST_P(ImportExpr, ImportImaginaryLiteralExpr) {
TEST_P(ImportExpr, ImportCompoundLiteralExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() {"
- " struct s { int x; long y; unsigned z; }; "
- " (void)(struct s){ 42, 0L, 1U }; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- compoundLiteralExpr(
- hasType(asString("struct s")),
- has(initListExpr(
- hasType(asString("struct s")),
- has(integerLiteral(
- equals(42), hasType(asString("int")))),
- has(integerLiteral(
- equals(0), hasType(asString("long")))),
- has(integerLiteral(
- equals(1), hasType(asString("unsigned int"))))))))));
+ testImport("void declToImport() {"
+ " struct s { int x; long y; unsigned z; }; "
+ " (void)(struct s){ 42, 0L, 1U }; }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(compoundLiteralExpr(
+ hasType(asString("struct s")),
+ has(initListExpr(
+ hasType(asString("struct s")),
+ has(integerLiteral(equals(42), hasType(asString("int")))),
+ has(integerLiteral(equals(0), hasType(asString("long")))),
+ has(integerLiteral(
+ equals(1), hasType(asString("unsigned int"))))))))));
}
TEST_P(ImportExpr, ImportCXXThisExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "class declToImport { void f() { (void)this; } };",
- Lang_CXX, "", Lang_CXX, Verifier,
- cxxRecordDecl(
- hasMethod(
- hasDescendant(
- cxxThisExpr(
- hasType(
- asString("class declToImport *")))))));
+ testImport("class declToImport { void f() { (void)this; } };", Lang_CXX03, "",
+ Lang_CXX03, Verifier,
+ cxxRecordDecl(hasMethod(hasDescendant(
+ cxxThisExpr(hasType(asString("class declToImport *")))))));
}
TEST_P(ImportExpr, ImportAtomicExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() { int *ptr; __atomic_load_n(ptr, 1); }",
- Lang_C, "", Lang_C, Verifier,
- functionDecl(hasDescendant(
- atomicExpr(
- has(ignoringParenImpCasts(
- declRefExpr(hasDeclaration(varDecl(hasName("ptr"))),
- hasType(asString("int *"))))),
- has(integerLiteral(equals(1), hasType(asString("int"))))))));
+ testImport("void declToImport() { int *ptr; __atomic_load_n(ptr, 1); }",
+ Lang_C99, "", Lang_C99, Verifier,
+ functionDecl(hasDescendant(atomicExpr(
+ has(ignoringParenImpCasts(
+ declRefExpr(hasDeclaration(varDecl(hasName("ptr"))),
+ hasType(asString("int *"))))),
+ has(integerLiteral(equals(1), hasType(asString("int"))))))));
}
TEST_P(ImportExpr, ImportLabelDeclAndAddrLabelExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() { loop: goto loop; (void)&&loop; }",
- Lang_C, "", Lang_C, Verifier,
- functionDecl(
- hasDescendant(
- labelStmt(hasDeclaration(labelDecl(hasName("loop"))))),
- hasDescendant(
- addrLabelExpr(hasDeclaration(labelDecl(hasName("loop")))))));
+ testImport("void declToImport() { loop: goto loop; (void)&&loop; }", Lang_C99,
+ "", Lang_C99, Verifier,
+ functionDecl(hasDescendant(labelStmt(
+ hasDeclaration(labelDecl(hasName("loop"))))),
+ hasDescendant(addrLabelExpr(
+ hasDeclaration(labelDecl(hasName("loop")))))));
}
AST_MATCHER_P(TemplateDecl, hasTemplateDecl,
@@ -618,7 +598,7 @@ TEST_P(ImportExpr, ImportParenListExpr) {
"template<typename T> class dummy { void f() { dummy X(*this); } };"
"typedef dummy<int> declToImport;"
"template class dummy<int>;",
- Lang_CXX, "", Lang_CXX, Verifier,
+ Lang_CXX03, "", Lang_CXX03, Verifier,
typedefDecl(hasType(templateSpecializationType(
hasDeclaration(classTemplateSpecializationDecl(hasSpecializedTemplate(
classTemplateDecl(hasTemplateDecl(cxxRecordDecl(hasMethod(allOf(
@@ -631,18 +611,17 @@ TEST_P(ImportExpr, ImportParenListExpr) {
TEST_P(ImportExpr, ImportSwitch) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() { int b; switch (b) { case 1: break; } }",
- Lang_C, "", Lang_C, Verifier,
- functionDecl(hasDescendant(
- switchStmt(has(compoundStmt(has(caseStmt())))))));
+ testImport("void declToImport() { int b; switch (b) { case 1: break; } }",
+ Lang_C99, "", Lang_C99, Verifier,
+ functionDecl(hasDescendant(
+ switchStmt(has(compoundStmt(has(caseStmt())))))));
}
TEST_P(ImportExpr, ImportStmtExpr) {
MatchVerifier<Decl> Verifier;
testImport(
"void declToImport() { int b; int a = b ?: 1; int C = ({int X=4; X;}); }",
- Lang_C, "", Lang_C, Verifier,
+ Lang_C99, "", Lang_C99, Verifier,
traverse(ast_type_traits::TK_AsIs,
functionDecl(hasDescendant(varDecl(
hasName("C"), hasType(asString("int")),
@@ -655,22 +634,19 @@ TEST_P(ImportExpr, ImportStmtExpr) {
TEST_P(ImportExpr, ImportConditionalOperator) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport() { (void)(true ? 1 : -5); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- conditionalOperator(
- hasCondition(cxxBoolLiteral(equals(true))),
- hasTrueExpression(integerLiteral(equals(1))),
- hasFalseExpression(
- unaryOperator(hasUnaryOperand(integerLiteral(equals(5))))))
- )));
+ testImport("void declToImport() { (void)(true ? 1 : -5); }", Lang_CXX03, "",
+ Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(conditionalOperator(
+ hasCondition(cxxBoolLiteral(equals(true))),
+ hasTrueExpression(integerLiteral(equals(1))),
+ hasFalseExpression(unaryOperator(
+ hasUnaryOperand(integerLiteral(equals(5)))))))));
}
TEST_P(ImportExpr, ImportBinaryConditionalOperator) {
MatchVerifier<Decl> Verifier;
testImport(
- "void declToImport() { (void)(1 ?: -5); }", Lang_CXX, "", Lang_CXX,
+ "void declToImport() { (void)(1 ?: -5); }", Lang_CXX03, "", Lang_CXX03,
Verifier,
traverse(ast_type_traits::TK_AsIs,
functionDecl(hasDescendant(binaryConditionalOperator(
@@ -692,35 +668,27 @@ TEST_P(ImportExpr, ImportDesignatedInitExpr) {
" struct point { double x; double y; };"
" struct point ptarray[10] = "
"{ [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 }; }",
- Lang_C, "", Lang_C, Verifier,
- functionDecl(hasDescendant(
- initListExpr(
- has(designatedInitExpr(
- designatorCountIs(2),
- hasDescendant(floatLiteral(equals(1.0))),
- hasDescendant(integerLiteral(equals(2))))),
- has(designatedInitExpr(
- designatorCountIs(2),
- hasDescendant(floatLiteral(equals(2.0))),
- hasDescendant(integerLiteral(equals(2))))),
- has(designatedInitExpr(
- designatorCountIs(2),
- hasDescendant(floatLiteral(equals(1.0))),
- hasDescendant(integerLiteral(equals(0)))))))));
+ Lang_C99, "", Lang_C99, Verifier,
+ functionDecl(hasDescendant(initListExpr(
+ has(designatedInitExpr(designatorCountIs(2),
+ hasDescendant(floatLiteral(equals(1.0))),
+ hasDescendant(integerLiteral(equals(2))))),
+ has(designatedInitExpr(designatorCountIs(2),
+ hasDescendant(floatLiteral(equals(2.0))),
+ hasDescendant(integerLiteral(equals(2))))),
+ has(designatedInitExpr(designatorCountIs(2),
+ hasDescendant(floatLiteral(equals(1.0))),
+ hasDescendant(integerLiteral(equals(0)))))))));
}
TEST_P(ImportExpr, ImportPredefinedExpr) {
MatchVerifier<Decl> Verifier;
// __func__ expands as StringLiteral("declToImport")
- testImport(
- "void declToImport() { (void)__func__; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- predefinedExpr(
- hasType(
- asString("const char [13]")),
- has(stringLiteral(hasType(
- asString("const char [13]"))))))));
+ testImport("void declToImport() { (void)__func__; }", Lang_CXX03, "",
+ Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(predefinedExpr(
+ hasType(asString("const char [13]")),
+ has(stringLiteral(hasType(asString("const char [13]"))))))));
}
TEST_P(ImportExpr, ImportInitListExpr) {
@@ -730,23 +698,15 @@ TEST_P(ImportExpr, ImportInitListExpr) {
" struct point { double x; double y; };"
" point ptarray[10] = { [2].y = 1.0, [2].x = 2.0,"
" [0].x = 1.0 }; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- initListExpr(
- has(
- cxxConstructExpr(
- requiresZeroInitialization())),
- has(
- initListExpr(
- hasType(asString("struct point")),
- has(floatLiteral(equals(1.0))),
- has(implicitValueInitExpr(
- hasType(asString("double")))))),
- has(
- initListExpr(
- hasType(asString("struct point")),
- has(floatLiteral(equals(2.0))),
- has(floatLiteral(equals(1.0)))))))));
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(initListExpr(
+ has(cxxConstructExpr(requiresZeroInitialization())),
+ has(initListExpr(
+ hasType(asString("struct point")), has(floatLiteral(equals(1.0))),
+ has(implicitValueInitExpr(hasType(asString("double")))))),
+ has(initListExpr(hasType(asString("struct point")),
+ has(floatLiteral(equals(2.0))),
+ has(floatLiteral(equals(1.0)))))))));
}
@@ -754,12 +714,11 @@ const internal::VariadicDynCastAllOfMatcher<Expr, VAArgExpr> vaArgExpr;
TEST_P(ImportExpr, ImportVAArgExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "void declToImport(__builtin_va_list list, ...) {"
- " (void)__builtin_va_arg(list, int); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- cStyleCastExpr(hasSourceExpression(vaArgExpr())))));
+ testImport("void declToImport(__builtin_va_list list, ...) {"
+ " (void)__builtin_va_arg(list, int); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(
+ cStyleCastExpr(hasSourceExpression(vaArgExpr())))));
}
TEST_P(ImportExpr, CXXTemporaryObjectExpr) {
@@ -767,7 +726,7 @@ TEST_P(ImportExpr, CXXTemporaryObjectExpr) {
testImport(
"struct C {};"
"void declToImport() { C c = C(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
+ Lang_CXX03, "", Lang_CXX03, Verifier,
traverse(ast_type_traits::TK_AsIs,
functionDecl(hasDescendant(exprWithCleanups(has(cxxConstructExpr(
has(materializeTemporaryExpr(has(implicitCastExpr(
@@ -784,34 +743,30 @@ TEST_P(ImportType, ImportAtomicType) {
TEST_P(ImportDecl, ImportFunctionTemplateDecl) {
MatchVerifier<Decl> Verifier;
- testImport(
- "template <typename T> void declToImport() { };",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionTemplateDecl());
+ testImport("template <typename T> void declToImport() { };", Lang_CXX03, "",
+ Lang_CXX03, Verifier, functionTemplateDecl());
}
TEST_P(ImportExpr, ImportCXXDependentScopeMemberExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "template <typename T> struct C { T t; };"
- "template <typename T> void declToImport() {"
- " C<T> d;"
- " (void)d.t;"
- "}"
- "void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionTemplateDecl(hasDescendant(
- cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
- testImport(
- "template <typename T> struct C { T t; };"
- "template <typename T> void declToImport() {"
- " C<T> d;"
- " (void)(&d)->t;"
- "}"
- "void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionTemplateDecl(hasDescendant(
- cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
+ testImport("template <typename T> struct C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " (void)d.t;"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionTemplateDecl(hasDescendant(
+ cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
+ testImport("template <typename T> struct C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " (void)(&d)->t;"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionTemplateDecl(hasDescendant(
+ cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
}
TEST_P(ImportType, ImportTypeAliasTemplate) {
@@ -864,16 +819,15 @@ const internal::VariadicDynCastAllOfMatcher<Type,
TEST_P(ImportType, ImportDependentTemplateSpecialization) {
MatchVerifier<Decl> Verifier;
- testImport(
- "template<typename T>"
- "struct A;"
- "template<typename T>"
- "struct declToImport {"
- " typename A<T>::template B<T> a;"
- "};",
- Lang_CXX, "", Lang_CXX, Verifier,
- classTemplateDecl(has(cxxRecordDecl(has(
- fieldDecl(hasType(dependentTemplateSpecializationType())))))));
+ testImport("template<typename T>"
+ "struct A;"
+ "template<typename T>"
+ "struct declToImport {"
+ " typename A<T>::template B<T> a;"
+ "};",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ classTemplateDecl(has(cxxRecordDecl(has(
+ fieldDecl(hasType(dependentTemplateSpecializationType())))))));
}
const internal::VariadicDynCastAllOfMatcher<Stmt, SizeOfPackExpr>
@@ -917,7 +871,7 @@ TEST_P(ImportExpr, ImportTypeTraitExpr) {
"void declToImport() { "
" (void)__builtin_types_compatible_p(int, int);"
"}",
- Lang_C, "", Lang_C, Verifier,
+ Lang_C99, "", Lang_C99, Verifier,
functionDecl(hasDescendant(typeTraitExpr(hasType(asString("int"))))));
}
@@ -961,7 +915,7 @@ TEST_P(ImportDecl, ImportRecordDeclInFunc) {
" struct data_t d;"
" return 0;"
"}",
- Lang_C, "", Lang_C, Verifier,
+ Lang_C99, "", Lang_C99, Verifier,
functionDecl(hasBody(compoundStmt(
has(declStmt(hasSingleDecl(varDecl(hasName("d")))))))));
}
@@ -972,12 +926,12 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportRecordTypeInFunc) {
" struct data_t d;"
" return 0;"
"}",
- Lang_C, "input.c");
+ Lang_C99, "input.c");
auto *FromVar =
FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("d")));
ASSERT_TRUE(FromVar);
auto ToType =
- ImportType(FromVar->getType().getCanonicalType(), FromVar, Lang_C);
+ ImportType(FromVar->getType().getCanonicalType(), FromVar, Lang_C99);
EXPECT_FALSE(ToType.isNull());
}
@@ -985,23 +939,23 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportRecordDeclInFuncParams) {
// This construct is not supported by ASTImporter.
Decl *FromTU = getTuDecl(
"int declToImport(struct data_t{int a;int b;} ***d){ return 0; }",
- Lang_C, "input.c");
+ Lang_C99, "input.c");
auto *From = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("declToImport")));
ASSERT_TRUE(From);
- auto *To = Import(From, Lang_C);
+ auto *To = Import(From, Lang_C99);
EXPECT_EQ(To, nullptr);
}
TEST_P(ASTImporterOptionSpecificTestBase, ImportRecordDeclInFuncFromMacro) {
- Decl *FromTU = getTuDecl(
- "#define NONAME_SIZEOF(type) sizeof(struct{type *dummy;}) \n"
- "int declToImport(){ return NONAME_SIZEOF(int); }",
- Lang_C, "input.c");
+ Decl *FromTU =
+ getTuDecl("#define NONAME_SIZEOF(type) sizeof(struct{type *dummy;}) \n"
+ "int declToImport(){ return NONAME_SIZEOF(int); }",
+ Lang_C99, "input.c");
auto *From = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("declToImport")));
ASSERT_TRUE(From);
- auto *To = Import(From, Lang_C);
+ auto *To = Import(From, Lang_C99);
ASSERT_TRUE(To);
EXPECT_TRUE(MatchVerifier<FunctionDecl>().match(
To, functionDecl(hasName("declToImport"),
@@ -1011,14 +965,14 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportRecordDeclInFuncFromMacro) {
TEST_P(ASTImporterOptionSpecificTestBase,
ImportRecordDeclInFuncParamsFromMacro) {
// This construct is not supported by ASTImporter.
- Decl *FromTU = getTuDecl(
- "#define PAIR_STRUCT(type) struct data_t{type a;type b;} \n"
- "int declToImport(PAIR_STRUCT(int) ***d){ return 0; }",
- Lang_C, "input.c");
+ Decl *FromTU =
+ getTuDecl("#define PAIR_STRUCT(type) struct data_t{type a;type b;} \n"
+ "int declToImport(PAIR_STRUCT(int) ***d){ return 0; }",
+ Lang_C99, "input.c");
auto *From = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("declToImport")));
ASSERT_TRUE(From);
- auto *To = Import(From, Lang_C);
+ auto *To = Import(From, Lang_C99);
EXPECT_EQ(To, nullptr);
}
@@ -1033,18 +987,16 @@ TEST_P(ImportExpr, ImportCXXPseudoDestructorExpr) {
" T t;"
" p->T::~T();"
"}",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(
- callExpr(has(cxxPseudoDestructorExpr())))));
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(callExpr(has(cxxPseudoDestructorExpr())))));
}
TEST_P(ImportDecl, ImportUsingDecl) {
MatchVerifier<Decl> Verifier;
- testImport(
- "namespace foo { int bar; }"
- "void declToImport() { using foo::bar; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionDecl(hasDescendant(usingDecl())));
+ testImport("namespace foo { int bar; }"
+ "void declToImport() { using foo::bar; }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionDecl(hasDescendant(usingDecl())));
}
/// \brief Matches shadow declarations introduced into a scope by a
@@ -1062,48 +1014,44 @@ const internal::VariadicDynCastAllOfMatcher<Decl,
TEST_P(ImportDecl, ImportUsingShadowDecl) {
MatchVerifier<Decl> Verifier;
- testImport(
- "namespace foo { int bar; }"
- "namespace declToImport { using foo::bar; }",
- Lang_CXX, "", Lang_CXX, Verifier,
- namespaceDecl(has(usingShadowDecl())));
+ testImport("namespace foo { int bar; }"
+ "namespace declToImport { using foo::bar; }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ namespaceDecl(has(usingShadowDecl())));
}
TEST_P(ImportExpr, ImportUnresolvedLookupExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "template<typename T> int foo();"
- "template <typename T> void declToImport() {"
- " (void)::foo<T>;"
- " (void)::template foo<T>;"
- "}"
- "void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionTemplateDecl(hasDescendant(unresolvedLookupExpr())));
+ testImport("template<typename T> int foo();"
+ "template <typename T> void declToImport() {"
+ " (void)::foo<T>;"
+ " (void)::template foo<T>;"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionTemplateDecl(hasDescendant(unresolvedLookupExpr())));
}
TEST_P(ImportExpr, ImportCXXUnresolvedConstructExpr) {
MatchVerifier<Decl> Verifier;
- testImport(
- "template <typename T> struct C { T t; };"
- "template <typename T> void declToImport() {"
- " C<T> d;"
- " d.t = T();"
- "}"
- "void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionTemplateDecl(hasDescendant(
- binaryOperator(has(cxxUnresolvedConstructExpr())))));
- testImport(
- "template <typename T> struct C { T t; };"
- "template <typename T> void declToImport() {"
- " C<T> d;"
- " (&d)->t = T();"
- "}"
- "void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionTemplateDecl(hasDescendant(
- binaryOperator(has(cxxUnresolvedConstructExpr())))));
+ testImport("template <typename T> struct C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " d.t = T();"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionTemplateDecl(hasDescendant(
+ binaryOperator(has(cxxUnresolvedConstructExpr())))));
+ testImport("template <typename T> struct C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " (&d)->t = T();"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionTemplateDecl(hasDescendant(
+ binaryOperator(has(cxxUnresolvedConstructExpr())))));
}
/// Check that function "declToImport()" (which is the templated function
@@ -1111,18 +1059,16 @@ TEST_P(ImportExpr, ImportCXXUnresolvedConstructExpr) {
/// Same for class template declarations.
TEST_P(ImportDecl, ImportTemplatedDeclForTemplate) {
MatchVerifier<Decl> Verifier;
- testImport(
- "template <typename T> void declToImport() { T a = 1; }"
- "void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- functionTemplateDecl(hasAncestor(translationUnitDecl(
- unless(has(functionDecl(hasName("declToImport"))))))));
- testImport(
- "template <typename T> struct declToImport { T t; };"
- "void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX, Verifier,
- classTemplateDecl(hasAncestor(translationUnitDecl(
- unless(has(cxxRecordDecl(hasName("declToImport"))))))));
+ testImport("template <typename T> void declToImport() { T a = 1; }"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ functionTemplateDecl(hasAncestor(translationUnitDecl(
+ unless(has(functionDecl(hasName("declToImport"))))))));
+ testImport("template <typename T> struct declToImport { T t; };"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ classTemplateDecl(hasAncestor(translationUnitDecl(
+ unless(has(cxxRecordDecl(hasName("declToImport"))))))));
}
TEST_P(ImportDecl, ImportClassTemplatePartialSpecialization) {
@@ -1134,7 +1080,7 @@ TEST_P(ImportDecl, ImportClassTemplatePartialSpecialization) {
template <typename T0> struct X<T0 *> {};
};
)s";
- testImport(Code, Lang_CXX, "", Lang_CXX, Verifier,
+ testImport(Code, Lang_CXX03, "", Lang_CXX03, Verifier,
recordDecl(has(classTemplateDecl()),
has(classTemplateSpecializationDecl())));
}
@@ -1145,25 +1091,24 @@ TEST_P(ImportExpr, CXXOperatorCallExpr) {
"class declToImport {"
" void f() { *this = declToImport(); }"
"};",
- Lang_CXX, "", Lang_CXX, Verifier,
- cxxRecordDecl(has(cxxMethodDecl(hasDescendant(
- cxxOperatorCallExpr())))));
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ cxxRecordDecl(has(cxxMethodDecl(hasDescendant(cxxOperatorCallExpr())))));
}
TEST_P(ImportExpr, DependentSizedArrayType) {
MatchVerifier<Decl> Verifier;
- testImport(
- "template<typename T, int Size> class declToImport {"
- " T data[Size];"
- "};",
- Lang_CXX, "", Lang_CXX, Verifier,
- classTemplateDecl(has(cxxRecordDecl(
- has(fieldDecl(hasType(dependentSizedArrayType())))))));
+ testImport("template<typename T, int Size> class declToImport {"
+ " T data[Size];"
+ "};",
+ Lang_CXX03, "", Lang_CXX03, Verifier,
+ classTemplateDecl(has(cxxRecordDecl(
+ has(fieldDecl(hasType(dependentSizedArrayType())))))));
}
TEST_P(ASTImporterOptionSpecificTestBase, ImportBeginLocOfDeclRefExpr) {
- Decl *FromTU = getTuDecl(
- "class A { public: static int X; }; void f() { (void)A::X; }", Lang_CXX);
+ Decl *FromTU =
+ getTuDecl("class A { public: static int X; }; void f() { (void)A::X; }",
+ Lang_CXX03);
auto From = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
ASSERT_TRUE(From);
@@ -1172,7 +1117,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportBeginLocOfDeclRefExpr) {
->getSubExpr()
->getBeginLoc()
.isValid());
- FunctionDecl *To = Import(From, Lang_CXX);
+ FunctionDecl *To = Import(From, Lang_CXX03);
ASSERT_TRUE(To);
ASSERT_TRUE(
cast<CStyleCastExpr>(cast<CompoundStmt>(To->getBody())->body_front())
@@ -1183,41 +1128,41 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportBeginLocOfDeclRefExpr) {
TEST_P(ASTImporterOptionSpecificTestBase,
ImportOfTemplatedDeclOfClassTemplateDecl) {
- Decl *FromTU = getTuDecl("template<class X> struct S{};", Lang_CXX);
+ Decl *FromTU = getTuDecl("template<class X> struct S{};", Lang_CXX03);
auto From =
FirstDeclMatcher<ClassTemplateDecl>().match(FromTU, classTemplateDecl());
ASSERT_TRUE(From);
- auto To = cast<ClassTemplateDecl>(Import(From, Lang_CXX));
+ auto To = cast<ClassTemplateDecl>(Import(From, Lang_CXX03));
ASSERT_TRUE(To);
Decl *ToTemplated = To->getTemplatedDecl();
- Decl *ToTemplated1 = Import(From->getTemplatedDecl(), Lang_CXX);
+ Decl *ToTemplated1 = Import(From->getTemplatedDecl(), Lang_CXX03);
EXPECT_TRUE(ToTemplated1);
EXPECT_EQ(ToTemplated1, ToTemplated);
}
TEST_P(ASTImporterOptionSpecificTestBase,
ImportOfTemplatedDeclOfFunctionTemplateDecl) {
- Decl *FromTU = getTuDecl("template<class X> void f(){}", Lang_CXX);
+ Decl *FromTU = getTuDecl("template<class X> void f(){}", Lang_CXX03);
auto From = FirstDeclMatcher<FunctionTemplateDecl>().match(
FromTU, functionTemplateDecl());
ASSERT_TRUE(From);
- auto To = cast<FunctionTemplateDecl>(Import(From, Lang_CXX));
+ auto To = cast<FunctionTemplateDecl>(Import(From, Lang_CXX03));
ASSERT_TRUE(To);
Decl *ToTemplated = To->getTemplatedDecl();
- Decl *ToTemplated1 = Import(From->getTemplatedDecl(), Lang_CXX);
+ Decl *ToTemplated1 = Import(From->getTemplatedDecl(), Lang_CXX03);
EXPECT_TRUE(ToTemplated1);
EXPECT_EQ(ToTemplated1, ToTemplated);
}
TEST_P(ASTImporterOptionSpecificTestBase,
ImportOfTemplatedDeclShouldImportTheClassTemplateDecl) {
- Decl *FromTU = getTuDecl("template<class X> struct S{};", Lang_CXX);
+ Decl *FromTU = getTuDecl("template<class X> struct S{};", Lang_CXX03);
auto FromFT =
FirstDeclMatcher<ClassTemplateDecl>().match(FromTU, classTemplateDecl());
ASSERT_TRUE(FromFT);
auto ToTemplated =
- cast<CXXRecordDecl>(Import(FromFT->getTemplatedDecl(), Lang_CXX));
+ cast<CXXRecordDecl>(Import(FromFT->getTemplatedDecl(), Lang_CXX03));
EXPECT_TRUE(ToTemplated);
auto ToTU = ToTemplated->getTranslationUnitDecl();
auto ToFT =
@@ -1227,13 +1172,13 @@ TEST_P(ASTImporterOptionSpecificTestBase,
TEST_P(ASTImporterOptionSpecificTestBase,
ImportOfTemplatedDeclShouldImportTheFunctionTemplateDecl) {
- Decl *FromTU = getTuDecl("template<class X> void f(){}", Lang_CXX);
+ Decl *FromTU = getTuDecl("template<class X> void f(){}", Lang_CXX03);
auto FromFT = FirstDeclMatcher<FunctionTemplateDecl>().match(
FromTU, functionTemplateDecl());
ASSERT_TRUE(FromFT);
auto ToTemplated =
- cast<FunctionDecl>(Import(FromFT->getTemplatedDecl(), Lang_CXX));
+ cast<FunctionDecl>(Import(FromFT->getTemplatedDecl(), Lang_CXX03));
EXPECT_TRUE(ToTemplated);
auto ToTU = ToTemplated->getTranslationUnitDecl();
auto ToFT = FirstDeclMatcher<FunctionTemplateDecl>().match(
@@ -1250,10 +1195,10 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportCorrectTemplatedDecl) {
template<class X> struct S3{};
}
)";
- Decl *FromTU = getTuDecl(Code, Lang_CXX);
+ Decl *FromTU = getTuDecl(Code, Lang_CXX03);
auto FromNs =
FirstDeclMatcher<NamespaceDecl>().match(FromTU, namespaceDecl());
- auto ToNs = cast<NamespaceDecl>(Import(FromNs, Lang_CXX));
+ auto ToNs = cast<NamespaceDecl>(Import(FromNs, Lang_CXX03));
ASSERT_TRUE(ToNs);
auto From =
FirstDeclMatcher<ClassTemplateDecl>().match(FromTU,
@@ -1267,7 +1212,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportCorrectTemplatedDecl) {
ASSERT_TRUE(To);
auto ToTemplated = To->getTemplatedDecl();
auto ToTemplated1 =
- cast<CXXRecordDecl>(Import(From->getTemplatedDecl(), Lang_CXX));
+ cast<CXXRecordDecl>(Import(From->getTemplatedDecl(), Lang_CXX03));
EXPECT_TRUE(ToTemplated1);
ASSERT_EQ(ToTemplated1, ToTemplated);
}
@@ -1277,8 +1222,8 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportChooseExpr) {
// gets it right.
Decl *From, *To;
std::tie(From, To) = getImportedDecl(
- "void declToImport() { (void)__builtin_choose_expr(1, 0, 1); }",
- Lang_C, "", Lang_C);
+ "void declToImport() { (void)__builtin_choose_expr(1, 0, 1); }", Lang_C99,
+ "", Lang_C99);
auto ToResults = match(chooseExpr().bind("choose"), To->getASTContext());
auto FromResults = match(chooseExpr().bind("choose"), From->getASTContext());
@@ -1311,7 +1256,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
}
};
)",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
MatchVerifier<Decl> Verifier;
auto Matcher = functionDecl(hasName("declToImport"),
@@ -1329,7 +1274,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
std::tie(From, To) =
getImportedDecl("template <typename T> void declToImport() { T a = 1; }"
"void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
auto Check = [](Decl *D) -> bool {
auto TU = D->getTranslationUnitDecl();
@@ -1355,7 +1300,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
std::tie(From, To) =
getImportedDecl("template <typename T> struct declToImport { T t; };"
"void instantiate() { declToImport<int>(); }",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
auto Check = [](Decl *D) -> bool {
auto TU = D->getTranslationUnitDecl();
@@ -1413,7 +1358,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
class Base {};
class declToImport : public Base<declToImport> {};
)",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
// Check that the ClassTemplateSpecializationDecl is NOT the child of the TU.
auto Pattern =
@@ -1459,7 +1404,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
template class X<int>;
}
)",
- Lang_CXX, "", Lang_CXX, "NS");
+ Lang_CXX03, "", Lang_CXX03, "NS");
// Check that the ClassTemplateSpecializationDecl is NOT the child of the
// ClassTemplateDecl.
@@ -1542,7 +1487,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ShouldImportImplicitCXXRecordDecl) {
struct declToImport {
};
)",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
MatchVerifier<Decl> Verifier;
// Match the implicit Decl.
@@ -1560,7 +1505,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
struct declToImport {
};
)",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
MatchVerifier<Decl> Verifier;
// Match the implicit Decl.
@@ -1578,7 +1523,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
class Base {};
class declToImport : public Base<declToImport> {};
)",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
auto hasImplicitClass = has(cxxRecordDecl());
auto Pattern = translationUnitDecl(has(classTemplateDecl(
@@ -1593,7 +1538,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
TEST_P(ASTImporterOptionSpecificTestBase, IDNSOrdinary) {
Decl *From, *To;
std::tie(From, To) =
- getImportedDecl("void declToImport() {}", Lang_CXX, "", Lang_CXX);
+ getImportedDecl("void declToImport() {}", Lang_CXX03, "", Lang_CXX03);
MatchVerifier<Decl> Verifier;
auto Matcher = functionDecl();
@@ -1608,9 +1553,9 @@ TEST_P(ASTImporterOptionSpecificTestBase, IDNSOfNonmemberOperator) {
struct X {};
void operator<<(int, X);
)",
- Lang_CXX);
+ Lang_CXX03);
Decl *From = LastDeclMatcher<Decl>{}.match(FromTU, functionDecl());
- const Decl *To = Import(From, Lang_CXX);
+ const Decl *To = Import(From, Lang_CXX03);
EXPECT_EQ(From->getIdentifierNamespace(), To->getIdentifierNamespace());
}
@@ -1623,7 +1568,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
class Base { int a; };
class declToImport : Base<declToImport> {};
)",
- Lang_CXX, "", Lang_CXX);
+ Lang_CXX03, "", Lang_CXX03);
auto Pattern = translationUnitDecl(has(classTemplateDecl(
hasName("Base"),
@@ -1642,11 +1587,11 @@ TEST_P(ASTImporterOptionSpecificTestBase,
template <typename T>
struct B;
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU, classTemplateDecl(hasName("B")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
}
{
@@ -1657,13 +1602,13 @@ TEST_P(ASTImporterOptionSpecificTestBase,
void f();
};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
FunctionDecl *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
auto *FromCTD = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU, classTemplateDecl(hasName("B")));
- auto *ToCTD = cast<ClassTemplateDecl>(Import(FromCTD, Lang_CXX));
+ auto *ToCTD = cast<ClassTemplateDecl>(Import(FromCTD, Lang_CXX03));
EXPECT_TRUE(ToCTD->isThisDeclarationADefinition());
}
}
@@ -1680,7 +1625,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
template <typename T>
struct B;
)",
- Lang_CXX);
+ Lang_CXX03);
ASSERT_EQ(1u, DeclCounterWithPredicate<ClassTemplateDecl>(
[](const ClassTemplateDecl *T) {
return T->isThisDeclarationADefinition();
@@ -1694,11 +1639,11 @@ TEST_P(ASTImporterOptionSpecificTestBase,
void f();
};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
ClassTemplateDecl *FromD = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU, classTemplateDecl(hasName("B")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
// We should have only one definition.
EXPECT_EQ(1u, DeclCounterWithPredicate<ClassTemplateDecl>(
@@ -1718,7 +1663,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
struct B;
)",
- Lang_CXX);
+ Lang_CXX03);
ASSERT_EQ(2u, DeclCounter<CXXRecordDecl>().match(
ToTU, cxxRecordDecl(unless(isImplicit()))));
@@ -1728,11 +1673,11 @@ TEST_P(ASTImporterOptionSpecificTestBase,
void f();
};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("B")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
EXPECT_EQ(2u, DeclCounter<CXXRecordDecl>().match(
ToTU, cxxRecordDecl(unless(isImplicit()))));
@@ -1761,9 +1706,9 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportSourceLocs) {
MFOO(a);
}
)",
- Lang_CXX);
+ Lang_CXX03);
auto FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, functionDecl());
- auto ToD = Import(FromD, Lang_CXX);
+ auto ToD = Import(FromD, Lang_CXX03);
auto ToLHS = LastDeclMatcher<DeclRefExpr>().match(ToD, declRefExpr());
auto FromLHS = LastDeclMatcher<DeclRefExpr>().match(FromTU, declRefExpr());
@@ -1788,9 +1733,9 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportNestedMacro) {
#define FUNC FUNC_INT
FUNC(int a);
)",
- Lang_CXX);
+ Lang_CXX03);
auto FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, functionDecl());
- auto ToD = Import(FromD, Lang_CXX);
+ auto ToD = Import(FromD, Lang_CXX03);
SourceManager &ToSM = ToAST->getASTContext().getSourceManager();
SourceManager &FromSM = FromD->getASTContext().getSourceManager();
@@ -1812,7 +1757,7 @@ TEST_P(
template <>
struct B<int>;
)",
- Lang_CXX);
+ Lang_CXX03);
// We should have only one definition.
ASSERT_EQ(1u, DeclCounterWithPredicate<ClassTemplateSpecializationDecl>(
[](const ClassTemplateSpecializationDecl *T) {
@@ -1828,11 +1773,11 @@ TEST_P(
template <>
struct B<int> {};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match(
FromTU, classTemplateSpecializationDecl(hasName("B")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
// We should have only one definition.
EXPECT_EQ(1u, DeclCounterWithPredicate<ClassTemplateSpecializationDecl>(
@@ -1848,7 +1793,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ObjectsWithUnnamedStructType) {
struct { int a; int b; } object0 = { 2, 3 };
struct { int x; int y; int z; } object1;
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *Obj0 =
FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("object0")));
@@ -1857,8 +1802,8 @@ TEST_P(ASTImporterOptionSpecificTestBase, ObjectsWithUnnamedStructType) {
FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("object1")));
auto *From1 = getRecordDecl(Obj1);
- auto *To0 = Import(From0, Lang_CXX);
- auto *To1 = Import(From1, Lang_CXX);
+ auto *To0 = Import(From0, Lang_CXX03);
+ auto *To1 = Import(From1, Lang_CXX03);
EXPECT_TRUE(To0);
EXPECT_TRUE(To1);
@@ -1874,16 +1819,16 @@ TEST_P(ASTImporterOptionSpecificTestBase, AnonymousRecords) {
struct { int b; };
};
)";
- Decl *FromTU0 = getTuDecl(Code, Lang_C, "input0.c");
+ Decl *FromTU0 = getTuDecl(Code, Lang_C99, "input0.c");
- Decl *FromTU1 = getTuDecl(Code, Lang_C, "input1.c");
+ Decl *FromTU1 = getTuDecl(Code, Lang_C99, "input1.c");
auto *X0 =
FirstDeclMatcher<RecordDecl>().match(FromTU0, recordDecl(hasName("X")));
auto *X1 =
FirstDeclMatcher<RecordDecl>().match(FromTU1, recordDecl(hasName("X")));
- Import(X0, Lang_C);
- Import(X1, Lang_C);
+ Import(X0, Lang_C99);
+ Import(X1, Lang_C99);
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
// We expect no (ODR) warning during the import.
@@ -1900,7 +1845,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, AnonymousRecordsReversed) {
struct { int b; };
};
)",
- Lang_C, "input0.c");
+ Lang_C99, "input0.c");
Decl *FromTU1 = getTuDecl(
R"(
@@ -1909,14 +1854,14 @@ TEST_P(ASTImporterOptionSpecificTestBase, AnonymousRecordsReversed) {
struct { int a; };
};
)",
- Lang_C, "input1.c");
+ Lang_C99, "input1.c");
auto *X0 =
FirstDeclMatcher<RecordDecl>().match(FromTU0, recordDecl(hasName("X")));
auto *X1 =
FirstDeclMatcher<RecordDecl>().match(FromTU1, recordDecl(hasName("X")));
- Import(X0, Lang_C);
- Import(X1, Lang_C);
+ Import(X0, Lang_C99);
+ Import(X1, Lang_C99);
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
// We expect one (ODR) warning during the import.
@@ -1929,24 +1874,24 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportDoesUpdateUsedFlag) {
auto Pattern = varDecl(hasName("x"));
VarDecl *Imported1;
{
- Decl *FromTU = getTuDecl("extern int x;", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("extern int x;", Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
- Imported1 = cast<VarDecl>(Import(FromD, Lang_CXX));
+ Imported1 = cast<VarDecl>(Import(FromD, Lang_CXX03));
}
VarDecl *Imported2;
{
- Decl *FromTU = getTuDecl("int x;", Lang_CXX, "input1.cc");
+ Decl *FromTU = getTuDecl("int x;", Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
- Imported2 = cast<VarDecl>(Import(FromD, Lang_CXX));
+ Imported2 = cast<VarDecl>(Import(FromD, Lang_CXX03));
}
EXPECT_EQ(Imported1->getCanonicalDecl(), Imported2->getCanonicalDecl());
EXPECT_FALSE(Imported2->isUsed(false));
{
- Decl *FromTU =
- getTuDecl("extern int x; int f() { return x; }", Lang_CXX, "input2.cc");
+ Decl *FromTU = getTuDecl("extern int x; int f() { return x; }", Lang_CXX03,
+ "input2.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
}
EXPECT_TRUE(Imported2->isUsed(false));
}
@@ -1955,16 +1900,16 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportDoesUpdateUsedFlag2) {
auto Pattern = varDecl(hasName("x"));
VarDecl *ExistingD;
{
- Decl *ToTU = getToTuDecl("int x = 1;", Lang_CXX);
+ Decl *ToTU = getToTuDecl("int x = 1;", Lang_CXX03);
ExistingD = FirstDeclMatcher<VarDecl>().match(ToTU, Pattern);
}
EXPECT_FALSE(ExistingD->isUsed(false));
{
- Decl *FromTU = getTuDecl(
- "int x = 1; int f() { return x; }", Lang_CXX, "input1.cc");
+ Decl *FromTU =
+ getTuDecl("int x = 1; int f() { return x; }", Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
}
EXPECT_TRUE(ExistingD->isUsed(false));
}
@@ -1978,7 +1923,8 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportDoesUpdateUsedFlag3) {
struct A {
static const int a = 1;
};
- )", Lang_CXX);
+ )",
+ Lang_CXX03);
ExistingD = FirstDeclMatcher<VarDecl>().match(ToTU, Pattern);
}
EXPECT_FALSE(ExistingD->isUsed(false));
@@ -1990,12 +1936,13 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportDoesUpdateUsedFlag3) {
};
const int *f() { return &A::a; } // requires storage,
// thus used flag will be set
- )", Lang_CXX, "input1.cc");
+ )",
+ Lang_CXX03, "input1.cc");
auto *FromFunD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
auto *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
ASSERT_TRUE(FromD->isUsed(false));
- Import(FromFunD, Lang_CXX);
+ Import(FromFunD, Lang_CXX03);
}
EXPECT_TRUE(ExistingD->isUsed(false));
}
@@ -2003,15 +1950,15 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportDoesUpdateUsedFlag3) {
TEST_P(ASTImporterOptionSpecificTestBase, ReimportWithUsedFlag) {
auto Pattern = varDecl(hasName("x"));
- Decl *FromTU = getTuDecl("int x;", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("int x;", Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
- auto *Imported1 = cast<VarDecl>(Import(FromD, Lang_CXX));
+ auto *Imported1 = cast<VarDecl>(Import(FromD, Lang_CXX03));
ASSERT_FALSE(Imported1->isUsed(false));
FromD->setIsUsed();
- auto *Imported2 = cast<VarDecl>(Import(FromD, Lang_CXX));
+ auto *Imported2 = cast<VarDecl>(Import(FromD, Lang_CXX03));
EXPECT_EQ(Imported1, Imported2);
EXPECT_TRUE(Imported2->isUsed(false));
@@ -2020,12 +1967,12 @@ TEST_P(ASTImporterOptionSpecificTestBase, ReimportWithUsedFlag) {
struct ImportFunctions : ASTImporterOptionSpecificTestBase {};
TEST_P(ImportFunctions, ImportPrototypeOfRecursiveFunction) {
- Decl *FromTU = getTuDecl("void f(); void f() { f(); }", Lang_CXX);
+ Decl *FromTU = getTuDecl("void f(); void f() { f(); }", Lang_CXX03);
auto Pattern = functionDecl(hasName("f"));
auto *From =
FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern); // Proto
- Decl *ImportedD = Import(From, Lang_CXX);
+ Decl *ImportedD = Import(From, Lang_CXX03);
Decl *ToTU = ImportedD->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
@@ -2038,12 +1985,12 @@ TEST_P(ImportFunctions, ImportPrototypeOfRecursiveFunction) {
}
TEST_P(ImportFunctions, ImportDefinitionOfRecursiveFunction) {
- Decl *FromTU = getTuDecl("void f(); void f() { f(); }", Lang_CXX);
+ Decl *FromTU = getTuDecl("void f(); void f() { f(); }", Lang_CXX03);
auto Pattern = functionDecl(hasName("f"));
auto *From =
LastDeclMatcher<FunctionDecl>().match(FromTU, Pattern); // Def
- Decl *ImportedD = Import(From, Lang_CXX);
+ Decl *ImportedD = Import(From, Lang_CXX03);
Decl *ToTU = ImportedD->getTranslationUnitDecl();
EXPECT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
@@ -2064,12 +2011,12 @@ TEST_P(ImportFunctions, OverriddenMethodsShouldBeImported) {
)";
auto Pattern =
cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
- Decl *FromTU = getTuDecl(Code, Lang_CXX);
+ Decl *FromTU = getTuDecl(Code, Lang_CXX03);
CXXMethodDecl *Proto =
FirstDeclMatcher<CXXMethodDecl>().match(FromTU, Pattern);
ASSERT_EQ(Proto->size_overridden_methods(), 1u);
- CXXMethodDecl *To = cast<CXXMethodDecl>(Import(Proto, Lang_CXX));
+ CXXMethodDecl *To = cast<CXXMethodDecl>(Import(Proto, Lang_CXX03));
EXPECT_EQ(To->size_overridden_methods(), 1u);
}
@@ -2081,14 +2028,14 @@ TEST_P(ImportFunctions, VirtualFlagShouldBePreservedWhenImportingPrototype) {
)";
auto Pattern =
cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
- Decl *FromTU = getTuDecl(Code, Lang_CXX);
+ Decl *FromTU = getTuDecl(Code, Lang_CXX03);
CXXMethodDecl *Proto =
FirstDeclMatcher<CXXMethodDecl>().match(FromTU, Pattern);
CXXMethodDecl *Def = LastDeclMatcher<CXXMethodDecl>().match(FromTU, Pattern);
ASSERT_TRUE(Proto->isVirtual());
ASSERT_TRUE(Def->isVirtual());
- CXXMethodDecl *To = cast<CXXMethodDecl>(Import(Proto, Lang_CXX));
+ CXXMethodDecl *To = cast<CXXMethodDecl>(Import(Proto, Lang_CXX03));
EXPECT_TRUE(To->isVirtual());
}
@@ -2099,16 +2046,16 @@ TEST_P(ImportFunctions,
void f() {}
void f();
)",
- Lang_CXX);
+ Lang_CXX03);
ASSERT_EQ(1u,
DeclCounterWithPredicate<FunctionDecl>([](const FunctionDecl *FD) {
return FD->doesThisDeclarationHaveABody();
}).match(ToTU, functionDecl()));
- Decl *FromTU = getTuDecl("void f() {}", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("void f() {}", Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, functionDecl());
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
EXPECT_EQ(1u,
DeclCounterWithPredicate<FunctionDecl>([](const FunctionDecl *FD) {
@@ -2127,13 +2074,13 @@ TEST_P(ImportFunctions, ImportOverriddenMethodTwice) {
auto DFP =
cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
- Decl *FromTU0 = getTuDecl(Code, Lang_CXX);
+ Decl *FromTU0 = getTuDecl(Code, Lang_CXX03);
auto *DF = FirstDeclMatcher<CXXMethodDecl>().match(FromTU0, DFP);
- Import(DF, Lang_CXX);
+ Import(DF, Lang_CXX03);
- Decl *FromTU1 = getTuDecl(Code, Lang_CXX, "input1.cc");
+ Decl *FromTU1 = getTuDecl(Code, Lang_CXX03, "input1.cc");
auto *BF = FirstDeclMatcher<CXXMethodDecl>().match(FromTU1, BFP);
- Import(BF, Lang_CXX);
+ Import(BF, Lang_CXX03);
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2163,14 +2110,14 @@ TEST_P(ImportFunctions, ImportOverriddenMethodTwiceDefinitionFirst) {
auto FDefAllP = cxxMethodDecl(hasName("f"), isDefinition());
{
- Decl *FromTU = getTuDecl(CodeWithDef, Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl(CodeWithDef, Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<CXXMethodDecl>().match(FromTU, DFP);
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
}
{
- Decl *FromTU = getTuDecl(CodeWithoutDef, Lang_CXX, "input1.cc");
+ Decl *FromTU = getTuDecl(CodeWithoutDef, Lang_CXX03, "input1.cc");
auto *FromB = FirstDeclMatcher<CXXMethodDecl>().match(FromTU, BFP);
- Import(FromB, Lang_CXX);
+ Import(FromB, Lang_CXX03);
}
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2197,13 +2144,13 @@ TEST_P(ImportFunctions, ImportOverriddenMethodTwiceOutOfClassDef) {
auto DFP = cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))),
unless(isDefinition()));
- Decl *FromTU0 = getTuDecl(Code, Lang_CXX);
+ Decl *FromTU0 = getTuDecl(Code, Lang_CXX03);
auto *D = FirstDeclMatcher<CXXMethodDecl>().match(FromTU0, DFP);
- Import(D, Lang_CXX);
+ Import(D, Lang_CXX03);
- Decl *FromTU1 = getTuDecl(Code, Lang_CXX, "input1.cc");
+ Decl *FromTU1 = getTuDecl(Code, Lang_CXX03, "input1.cc");
auto *B = FirstDeclMatcher<CXXMethodDecl>().match(FromTU1, BFP);
- Import(B, Lang_CXX);
+ Import(B, Lang_CXX03);
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2254,15 +2201,15 @@ TEST_P(ImportFunctions,
auto FooDef = functionDecl(hasName("foo"));
{
- Decl *FromTU0 = getTuDecl(CodeTU0, Lang_CXX, "input0.cc");
+ Decl *FromTU0 = getTuDecl(CodeTU0, Lang_CXX03, "input0.cc");
auto *D = FirstDeclMatcher<CXXMethodDecl>().match(FromTU0, DFP);
- Import(D, Lang_CXX);
+ Import(D, Lang_CXX03);
}
{
- Decl *FromTU1 = getTuDecl(CodeTU1, Lang_CXX, "input1.cc");
+ Decl *FromTU1 = getTuDecl(CodeTU1, Lang_CXX03, "input1.cc");
auto *Foo = FirstDeclMatcher<FunctionDecl>().match(FromTU1, FooDef);
- Import(Foo, Lang_CXX);
+ Import(Foo, Lang_CXX03);
}
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2305,13 +2252,13 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportVariableChainInC) {
std::string Code = "static int v; static int v = 0;";
auto Pattern = varDecl(hasName("v"));
- TranslationUnitDecl *FromTu = getTuDecl(Code, Lang_C, "input0.c");
+ TranslationUnitDecl *FromTu = getTuDecl(Code, Lang_C99, "input0.c");
auto *From0 = FirstDeclMatcher<VarDecl>().match(FromTu, Pattern);
auto *From1 = LastDeclMatcher<VarDecl>().match(FromTu, Pattern);
- auto *To0 = Import(From0, Lang_C);
- auto *To1 = Import(From1, Lang_C);
+ auto *To0 = Import(From0, Lang_C99);
+ auto *To1 = Import(From1, Lang_C99);
EXPECT_TRUE(To0);
ASSERT_TRUE(To1);
@@ -2320,17 +2267,17 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportVariableChainInC) {
}
TEST_P(ImportFunctions, ImportFromDifferentScopedAnonNamespace) {
- TranslationUnitDecl *FromTu = getTuDecl(
- "namespace NS0 { namespace { void f(); } }"
- "namespace NS1 { namespace { void f(); } }",
- Lang_CXX, "input0.cc");
+ TranslationUnitDecl *FromTu =
+ getTuDecl("namespace NS0 { namespace { void f(); } }"
+ "namespace NS1 { namespace { void f(); } }",
+ Lang_CXX03, "input0.cc");
auto Pattern = functionDecl(hasName("f"));
auto *FromF0 = FirstDeclMatcher<FunctionDecl>().match(FromTu, Pattern);
auto *FromF1 = LastDeclMatcher<FunctionDecl>().match(FromTu, Pattern);
- auto *ToF0 = Import(FromF0, Lang_CXX);
- auto *ToF1 = Import(FromF1, Lang_CXX);
+ auto *ToF0 = Import(FromF0, Lang_CXX03);
+ auto *ToF1 = Import(FromF1, Lang_CXX03);
EXPECT_TRUE(ToF0);
ASSERT_TRUE(ToF1);
@@ -2341,19 +2288,19 @@ TEST_P(ImportFunctions, ImportFromDifferentScopedAnonNamespace) {
TEST_P(ImportFunctions, ImportFunctionFromUnnamedNamespace) {
{
Decl *FromTU = getTuDecl("namespace { void f() {} } void g0() { f(); }",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("g0")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
}
{
Decl *FromTU =
getTuDecl("namespace { void f() { int a; } } void g1() { f(); }",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("g1")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
}
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2371,7 +2318,7 @@ TEST_P(ImportFunctions, ImportImplicitFunctionsInLambda) {
Lang_CXX11);
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("foo")));
- auto *ToD = Import(FromD, Lang_CXX);
+ auto *ToD = Import(FromD, Lang_CXX03);
EXPECT_TRUE(ToD);
CXXRecordDecl *LambdaRec =
cast<LambdaExpr>(cast<CStyleCastExpr>(
@@ -2394,10 +2341,10 @@ TEST_P(ImportFunctions,
x.foo<int>();
}
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
- auto *ToD = Import(FromD, Lang_CXX);
+ auto *ToD = Import(FromD, Lang_CXX03);
EXPECT_TRUE(ToD);
EXPECT_TRUE(MatchVerifier<FunctionDecl>().match(
ToD, functionDecl(hasName("f"), hasDescendant(declRefExpr()))));
@@ -2420,10 +2367,10 @@ TEST_P(ImportFunctions,
f<int>();
}
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("g")));
- auto *ToD = Import(FromD, Lang_CXX);
+ auto *ToD = Import(FromD, Lang_CXX03);
EXPECT_TRUE(ToD);
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
EXPECT_TRUE(MatchVerifier<TranslationUnitDecl>().match(
@@ -2441,14 +2388,14 @@ TEST_P(ImportFunctionTemplates, ImportFunctionTemplateInRecordDeclTwice) {
void f(T t);
};
)";
- Decl *FromTU1 = getTuDecl(Code, Lang_CXX, "input1.cc");
+ Decl *FromTU1 = getTuDecl(Code, Lang_CXX03, "input1.cc");
auto *FromD1 = FirstDeclMatcher<FunctionTemplateDecl>().match(
FromTU1, functionTemplateDecl(hasName("f")));
- auto *ToD1 = Import(FromD1, Lang_CXX);
- Decl *FromTU2 = getTuDecl(Code, Lang_CXX, "input2.cc");
+ auto *ToD1 = Import(FromD1, Lang_CXX03);
+ Decl *FromTU2 = getTuDecl(Code, Lang_CXX03, "input2.cc");
auto *FromD2 = FirstDeclMatcher<FunctionTemplateDecl>().match(
FromTU2, functionTemplateDecl(hasName("f")));
- auto *ToD2 = Import(FromD2, Lang_CXX);
+ auto *ToD2 = Import(FromD2, Lang_CXX03);
EXPECT_EQ(ToD1, ToD2);
}
@@ -2463,14 +2410,14 @@ TEST_P(ImportFunctionTemplates,
template <class T>
void X::f(T t) {};
)";
- Decl *FromTU1 = getTuDecl(Code, Lang_CXX, "input1.cc");
+ Decl *FromTU1 = getTuDecl(Code, Lang_CXX03, "input1.cc");
auto *FromD1 = FirstDeclMatcher<FunctionTemplateDecl>().match(
FromTU1, functionTemplateDecl(hasName("f")));
- auto *ToD1 = Import(FromD1, Lang_CXX);
- Decl *FromTU2 = getTuDecl(Code, Lang_CXX, "input2.cc");
+ auto *ToD1 = Import(FromD1, Lang_CXX03);
+ Decl *FromTU2 = getTuDecl(Code, Lang_CXX03, "input2.cc");
auto *FromD2 = FirstDeclMatcher<FunctionTemplateDecl>().match(
FromTU2, functionTemplateDecl(hasName("f")));
- auto *ToD2 = Import(FromD2, Lang_CXX);
+ auto *ToD2 = Import(FromD2, Lang_CXX03);
EXPECT_EQ(ToD1, ToD2);
}
@@ -2482,11 +2429,11 @@ TEST_P(ImportFunctionTemplates,
void foo(T) {}
void foo();
)",
- Lang_CXX);
- Decl *FromTU = getTuDecl("void foo();", Lang_CXX);
+ Lang_CXX03);
+ Decl *FromTU = getTuDecl("void foo();", Lang_CXX03);
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("foo")));
- auto *ImportedD = Import(FromD, Lang_CXX);
+ auto *ImportedD = Import(FromD, Lang_CXX03);
EXPECT_TRUE(ImportedD);
}
@@ -2500,11 +2447,11 @@ TEST_P(ImportFunctionTemplates,
Foo();
};
)";
- getToTuDecl(Code, Lang_CXX);
- Decl *FromTU = getTuDecl(Code, Lang_CXX);
+ getToTuDecl(Code, Lang_CXX03);
+ Decl *FromTU = getTuDecl(Code, Lang_CXX03);
auto *FromD =
LastDeclMatcher<CXXConstructorDecl>().match(FromTU, cxxConstructorDecl());
- auto *ImportedD = Import(FromD, Lang_CXX);
+ auto *ImportedD = Import(FromD, Lang_CXX03);
EXPECT_TRUE(ImportedD);
}
@@ -2517,16 +2464,16 @@ TEST_P(ImportFunctionTemplates,
struct X{};
void operator<(X, X);
)",
- Lang_CXX);
+ Lang_CXX03);
Decl *FromTU = getTuDecl(
R"(
struct X{};
void operator<(X, X);
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromD = LastDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasOverloadedOperatorName("<")));
- auto *ImportedD = Import(FromD, Lang_CXX);
+ auto *ImportedD = Import(FromD, Lang_CXX03);
EXPECT_TRUE(ImportedD);
}
@@ -2537,11 +2484,10 @@ TEST_P(ImportFriendFunctions, ImportFriendFunctionRedeclChainProto) {
Decl *FromTU = getTuDecl("struct X { friend void f(); };"
"void f();",
- Lang_CXX,
- "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
ASSERT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
EXPECT_FALSE(ImportedD->doesThisDeclarationHaveABody());
@@ -2556,10 +2502,10 @@ TEST_P(ImportFriendFunctions,
Decl *FromTU = getTuDecl("void f();"
"struct X { friend void f(); };",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
ASSERT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
EXPECT_FALSE(ImportedD->doesThisDeclarationHaveABody());
@@ -2573,11 +2519,10 @@ TEST_P(ImportFriendFunctions, ImportFriendFunctionRedeclChainDef) {
Decl *FromTU = getTuDecl("struct X { friend void f(){} };"
"void f();",
- Lang_CXX,
- "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
ASSERT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
EXPECT_TRUE(ImportedD->doesThisDeclarationHaveABody());
@@ -2592,10 +2537,10 @@ TEST_P(ImportFriendFunctions,
Decl *FromTU = getTuDecl("struct X { friend void f(); };"
"void f(){}",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
ASSERT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
EXPECT_FALSE(ImportedD->doesThisDeclarationHaveABody());
@@ -2615,10 +2560,10 @@ TEST_P(ImportFriendFunctions, ImportFriendFunctionRedeclChainDefWithClass) {
friend void f(X *x);
};
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
ASSERT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
EXPECT_TRUE(ImportedD->doesThisDeclarationHaveABody());
@@ -2644,10 +2589,10 @@ TEST_P(ImportFriendFunctions,
friend void f(X *x);
};
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = LastDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ auto *ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
ASSERT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
EXPECT_FALSE(ImportedD->doesThisDeclarationHaveABody());
@@ -2667,15 +2612,15 @@ TEST_P(ImportFriendFunctions, ImportFriendFunctionFromMultipleTU) {
FunctionDecl *ImportedD;
{
Decl *FromTU =
- getTuDecl("struct X { friend void f(){} };", Lang_CXX, "input0.cc");
+ getTuDecl("struct X { friend void f(){} };", Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ ImportedD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
}
FunctionDecl *ImportedD1;
{
- Decl *FromTU = getTuDecl("void f();", Lang_CXX, "input1.cc");
+ Decl *FromTU = getTuDecl("void f();", Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, Pattern);
- ImportedD1 = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ ImportedD1 = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
}
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2690,7 +2635,7 @@ TEST_P(ImportFriendFunctions, Lookup) {
auto ClassPattern = cxxRecordDecl(hasName("X"));
TranslationUnitDecl *FromTU =
- getTuDecl("struct X { friend void f(); };", Lang_CXX, "input0.cc");
+ getTuDecl("struct X { friend void f(); };", Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, FunctionPattern);
ASSERT_TRUE(FromD->isInIdentifierNamespace(Decl::IDNS_OrdinaryFriend));
ASSERT_FALSE(FromD->isInIdentifierNamespace(Decl::IDNS_Ordinary));
@@ -2703,7 +2648,7 @@ TEST_P(ImportFriendFunctions, Lookup) {
ASSERT_EQ(LookupRes.size(), 1u);
}
- auto *ToD = cast<FunctionDecl>(Import(FromD, Lang_CXX));
+ auto *ToD = cast<FunctionDecl>(Import(FromD, Lang_CXX03));
auto ToName = ToD->getDeclName();
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2723,15 +2668,15 @@ TEST_P(ImportFriendFunctions, LookupWithProtoAfter) {
auto FunctionPattern = functionDecl(hasName("f"));
auto ClassPattern = cxxRecordDecl(hasName("X"));
- TranslationUnitDecl *FromTU = getTuDecl(
- "struct X { friend void f(); };"
- // This proto decl makes f available to normal
- // lookup, otherwise it is hidden.
- // Normal C++ lookup (implemented in
- // `clang::Sema::CppLookupName()` and in `LookupDirect()`)
- // returns the found `NamedDecl` only if the set IDNS is matched
- "void f();",
- Lang_CXX, "input0.cc");
+ TranslationUnitDecl *FromTU =
+ getTuDecl("struct X { friend void f(); };"
+ // This proto decl makes f available to normal
+ // lookup, otherwise it is hidden.
+ // Normal C++ lookup (implemented in
+ // `clang::Sema::CppLookupName()` and in `LookupDirect()`)
+ // returns the found `NamedDecl` only if the set IDNS is matched
+ "void f();",
+ Lang_CXX03, "input0.cc");
auto *FromFriend =
FirstDeclMatcher<FunctionDecl>().match(FromTU, FunctionPattern);
auto *FromNormal =
@@ -2749,7 +2694,7 @@ TEST_P(ImportFriendFunctions, LookupWithProtoAfter) {
LookupRes = FromTU->noload_lookup(FromName);
ASSERT_EQ(LookupRes.size(), 1u);
- auto *ToFriend = cast<FunctionDecl>(Import(FromFriend, Lang_CXX));
+ auto *ToFriend = cast<FunctionDecl>(Import(FromFriend, Lang_CXX03));
auto ToName = ToFriend->getDeclName();
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2773,10 +2718,9 @@ TEST_P(ImportFriendFunctions, LookupWithProtoBefore) {
auto FunctionPattern = functionDecl(hasName("f"));
auto ClassPattern = cxxRecordDecl(hasName("X"));
- TranslationUnitDecl *FromTU = getTuDecl(
- "void f();"
- "struct X { friend void f(); };",
- Lang_CXX, "input0.cc");
+ TranslationUnitDecl *FromTU = getTuDecl("void f();"
+ "struct X { friend void f(); };",
+ Lang_CXX03, "input0.cc");
auto *FromNormal =
FirstDeclMatcher<FunctionDecl>().match(FromTU, FunctionPattern);
auto *FromFriend =
@@ -2794,7 +2738,7 @@ TEST_P(ImportFriendFunctions, LookupWithProtoBefore) {
LookupRes = FromTU->noload_lookup(FromName);
ASSERT_EQ(LookupRes.size(), 1u);
- auto *ToNormal = cast<FunctionDecl>(Import(FromNormal, Lang_CXX));
+ auto *ToNormal = cast<FunctionDecl>(Import(FromNormal, Lang_CXX03));
auto ToName = ToNormal->getDeclName();
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -2817,11 +2761,11 @@ TEST_P(ImportFriendFunctions, ImportFriendChangesLookup) {
auto Pattern = functionDecl(hasName("f"));
TranslationUnitDecl *FromNormalTU =
- getTuDecl("void f();", Lang_CXX, "input0.cc");
+ getTuDecl("void f();", Lang_CXX03, "input0.cc");
auto *FromNormalF =
FirstDeclMatcher<FunctionDecl>().match(FromNormalTU, Pattern);
TranslationUnitDecl *FromFriendTU =
- getTuDecl("class X { friend void f(); };", Lang_CXX, "input1.cc");
+ getTuDecl("class X { friend void f(); };", Lang_CXX03, "input1.cc");
auto *FromFriendF =
FirstDeclMatcher<FunctionDecl>().match(FromFriendTU, Pattern);
auto FromNormalName = FromNormalF->getDeclName();
@@ -2836,7 +2780,7 @@ TEST_P(ImportFriendFunctions, ImportFriendChangesLookup) {
LookupRes = FromFriendTU->noload_lookup(FromFriendName);
ASSERT_EQ(LookupRes.size(), 1u);
- auto *ToNormalF = cast<FunctionDecl>(Import(FromNormalF, Lang_CXX));
+ auto *ToNormalF = cast<FunctionDecl>(Import(FromNormalF, Lang_CXX03));
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
auto ToName = ToNormalF->getDeclName();
EXPECT_TRUE(ToNormalF->isInIdentifierNamespace(Decl::IDNS_Ordinary));
@@ -2845,7 +2789,7 @@ TEST_P(ImportFriendFunctions, ImportFriendChangesLookup) {
EXPECT_EQ(LookupRes.size(), 1u);
EXPECT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 1u);
- auto *ToFriendF = cast<FunctionDecl>(Import(FromFriendF, Lang_CXX));
+ auto *ToFriendF = cast<FunctionDecl>(Import(FromFriendF, Lang_CXX03));
LookupRes = ToTU->noload_lookup(ToName);
EXPECT_EQ(LookupRes.size(), 1u);
EXPECT_EQ(DeclCounter<FunctionDecl>().match(ToTU, Pattern), 2u);
@@ -2858,10 +2802,9 @@ TEST_P(ImportFriendFunctions, ImportFriendChangesLookup) {
}
TEST_P(ImportFriendFunctions, ImportFriendList) {
- TranslationUnitDecl *FromTU = getTuDecl(
- "struct X { friend void f(); };"
- "void f();",
- Lang_CXX, "input0.cc");
+ TranslationUnitDecl *FromTU = getTuDecl("struct X { friend void f(); };"
+ "void f();",
+ Lang_CXX03, "input0.cc");
auto *FromFriendF = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
@@ -2876,7 +2819,7 @@ TEST_P(ImportFriendFunctions, ImportFriendList) {
}
ASSERT_EQ(FrN, 1u);
- Import(FromFriendF, Lang_CXX);
+ Import(FromFriendF, Lang_CXX03);
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
auto *ToClass = FirstDeclMatcher<CXXRecordDecl>().match(
ToTU, cxxRecordDecl(hasName("X")));
@@ -2902,20 +2845,20 @@ TEST_P(ImportDecl, ImportEnumSequential) {
{"void foo();"
"void moo();"
"int main() { foo(); moo(); }",
- Lang_C}},
+ Lang_C99}},
{"foo.c",
{"typedef enum { THING_VALUE } thing_t;"
"void conflict(thing_t type);"
"void foo() { (void)THING_VALUE; }"
"void conflict(thing_t type) {}",
- Lang_C}},
+ Lang_C99}},
{"moo.c",
{"typedef enum { THING_VALUE } thing_t;"
"void conflict(thing_t type);"
"void moo() { conflict(THING_VALUE); }",
- Lang_C}}};
+ Lang_C99}}};
auto VerificationMatcher =
enumDecl(has(enumConstantDecl(hasName("THING_VALUE"))),
@@ -3114,22 +3057,20 @@ TEST_P(ImportImplicitMethods, DoNotImportOtherMethod) {
TEST_P(ASTImporterOptionSpecificTestBase, ImportOfEquivalentRecord) {
Decl *ToR1;
{
- Decl *FromTU = getTuDecl(
- "struct A { };", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("struct A { };", Lang_CXX03, "input0.cc");
auto *FromR = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("A")));
- ToR1 = Import(FromR, Lang_CXX);
+ ToR1 = Import(FromR, Lang_CXX03);
}
Decl *ToR2;
{
- Decl *FromTU = getTuDecl(
- "struct A { };", Lang_CXX, "input1.cc");
+ Decl *FromTU = getTuDecl("struct A { };", Lang_CXX03, "input1.cc");
auto *FromR = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("A")));
- ToR2 = Import(FromR, Lang_CXX);
+ ToR2 = Import(FromR, Lang_CXX03);
}
EXPECT_EQ(ToR1, ToR2);
@@ -3138,19 +3079,18 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportOfEquivalentRecord) {
TEST_P(ASTImporterOptionSpecificTestBase, ImportOfNonEquivalentRecord) {
Decl *ToR1;
{
- Decl *FromTU = getTuDecl(
- "struct A { int x; };", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("struct A { int x; };", Lang_CXX03, "input0.cc");
auto *FromR = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("A")));
- ToR1 = Import(FromR, Lang_CXX);
+ ToR1 = Import(FromR, Lang_CXX03);
}
Decl *ToR2;
{
- Decl *FromTU = getTuDecl(
- "struct A { unsigned x; };", Lang_CXX, "input1.cc");
+ Decl *FromTU =
+ getTuDecl("struct A { unsigned x; };", Lang_CXX03, "input1.cc");
auto *FromR = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("A")));
- ToR2 = Import(FromR, Lang_CXX);
+ ToR2 = Import(FromR, Lang_CXX03);
}
EXPECT_NE(ToR1, ToR2);
}
@@ -3158,19 +3098,17 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportOfNonEquivalentRecord) {
TEST_P(ASTImporterOptionSpecificTestBase, ImportOfEquivalentField) {
Decl *ToF1;
{
- Decl *FromTU = getTuDecl(
- "struct A { int x; };", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("struct A { int x; };", Lang_CXX03, "input0.cc");
auto *FromF = FirstDeclMatcher<FieldDecl>().match(
FromTU, fieldDecl(hasName("x")));
- ToF1 = Import(FromF, Lang_CXX);
+ ToF1 = Import(FromF, Lang_CXX03);
}
Decl *ToF2;
{
- Decl *FromTU = getTuDecl(
- "struct A { int x; };", Lang_CXX, "input1.cc");
+ Decl *FromTU = getTuDecl("struct A { int x; };", Lang_CXX03, "input1.cc");
auto *FromF = FirstDeclMatcher<FieldDecl>().match(
FromTU, fieldDecl(hasName("x")));
- ToF2 = Import(FromF, Lang_CXX);
+ ToF2 = Import(FromF, Lang_CXX03);
}
EXPECT_EQ(ToF1, ToF2);
}
@@ -3178,19 +3116,18 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportOfEquivalentField) {
TEST_P(ASTImporterOptionSpecificTestBase, ImportOfNonEquivalentField) {
Decl *ToF1;
{
- Decl *FromTU = getTuDecl(
- "struct A { int x; };", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("struct A { int x; };", Lang_CXX03, "input0.cc");
auto *FromF = FirstDeclMatcher<FieldDecl>().match(
FromTU, fieldDecl(hasName("x")));
- ToF1 = Import(FromF, Lang_CXX);
+ ToF1 = Import(FromF, Lang_CXX03);
}
Decl *ToF2;
{
- Decl *FromTU = getTuDecl(
- "struct A { unsigned x; };", Lang_CXX, "input1.cc");
+ Decl *FromTU =
+ getTuDecl("struct A { unsigned x; };", Lang_CXX03, "input1.cc");
auto *FromF = FirstDeclMatcher<FieldDecl>().match(
FromTU, fieldDecl(hasName("x")));
- ToF2 = Import(FromF, Lang_CXX);
+ ToF2 = Import(FromF, Lang_CXX03);
}
EXPECT_NE(ToF1, ToF2);
}
@@ -3198,19 +3135,19 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportOfNonEquivalentField) {
TEST_P(ASTImporterOptionSpecificTestBase, ImportOfEquivalentMethod) {
Decl *ToM1;
{
- Decl *FromTU = getTuDecl(
- "struct A { void x(); }; void A::x() { }", Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("struct A { void x(); }; void A::x() { }",
+ Lang_CXX03, "input0.cc");
auto *FromM = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("x"), isDefinition()));
- ToM1 = Import(FromM, Lang_CXX);
+ ToM1 = Import(FromM, Lang_CXX03);
}
Decl *ToM2;
{
- Decl *FromTU = getTuDecl(
- "struct A { void x(); }; void A::x() { }", Lang_CXX, "input1.cc");
+ Decl *FromTU = getTuDecl("struct A { void x(); }; void A::x() { }",
+ Lang_CXX03, "input1.cc");
auto *FromM = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("x"), isDefinition()));
- ToM2 = Import(FromM, Lang_CXX);
+ ToM2 = Import(FromM, Lang_CXX03);
}
EXPECT_EQ(ToM1, ToM2);
}
@@ -3218,21 +3155,20 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportOfEquivalentMethod) {
TEST_P(ASTImporterOptionSpecificTestBase, ImportOfNonEquivalentMethod) {
Decl *ToM1;
{
- Decl *FromTU = getTuDecl(
- "struct A { void x(); }; void A::x() { }",
- Lang_CXX, "input0.cc");
+ Decl *FromTU = getTuDecl("struct A { void x(); }; void A::x() { }",
+ Lang_CXX03, "input0.cc");
auto *FromM = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("x"), isDefinition()));
- ToM1 = Import(FromM, Lang_CXX);
+ ToM1 = Import(FromM, Lang_CXX03);
}
Decl *ToM2;
{
- Decl *FromTU = getTuDecl(
- "struct A { void x() const; }; void A::x() const { }",
- Lang_CXX, "input1.cc");
+ Decl *FromTU =
+ getTuDecl("struct A { void x() const; }; void A::x() const { }",
+ Lang_CXX03, "input1.cc");
auto *FromM = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("x"), isDefinition()));
- ToM2 = Import(FromM, Lang_CXX);
+ ToM2 = Import(FromM, Lang_CXX03);
}
EXPECT_NE(ToM1, ToM2);
}
@@ -3250,11 +3186,11 @@ TEST_P(ASTImporterOptionSpecificTestBase,
} entry1;
};
)",
- Lang_C, "input0.cc");
+ Lang_C99, "input0.cc");
auto *From =
FirstDeclMatcher<RecordDecl>().match(FromTU, recordDecl(hasName("A")));
- Import(From, Lang_C);
+ Import(From, Lang_C99);
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
auto *Entry0 =
@@ -3594,7 +3530,8 @@ TEST_P(ImportVariables, ImportOfOneDeclBringsInTheWholeChain) {
static const int a = 1 + 2;
};
const int A::a;
- )", Lang_CXX, "input1.cc");
+ )",
+ Lang_CXX03, "input1.cc");
auto *FromDWithInit = FirstDeclMatcher<VarDecl>().match(
FromTU, varDecl(hasName("a"))); // Decl with init
@@ -3618,8 +3555,8 @@ TEST_P(ImportVariables, InitAndDefinitionAreInDifferentTUs) {
static const int a = 1 + 2;
};
)";
- Decl *ToTU = getToTuDecl(StructA, Lang_CXX);
- Decl *FromTU = getTuDecl(std::string(StructA) + "const int A::a;", Lang_CXX,
+ Decl *ToTU = getToTuDecl(StructA, Lang_CXX03);
+ Decl *FromTU = getTuDecl(std::string(StructA) + "const int A::a;", Lang_CXX03,
"input1.cc");
auto *FromDWithInit = FirstDeclMatcher<VarDecl>().match(
@@ -3649,9 +3586,9 @@ TEST_P(ImportVariables, InitAndDefinitionAreInTheFromContext) {
static const int a;
};
)";
- Decl *ToTU = getToTuDecl(StructA, Lang_CXX);
+ Decl *ToTU = getToTuDecl(StructA, Lang_CXX03);
Decl *FromTU = getTuDecl(std::string(StructA) + "const int A::a = 1 + 2;",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *FromDDeclarationOnly = FirstDeclMatcher<VarDecl>().match(
FromTU, varDecl(hasName("a")));
@@ -3676,13 +3613,13 @@ TEST_P(ImportVariables, InitAndDefinitionAreInTheFromContext) {
struct ImportClasses : ASTImporterOptionSpecificTestBase {};
TEST_P(ImportClasses, ImportDefinitionWhenProtoIsInNestedToContext) {
- Decl *ToTU = getToTuDecl("struct A { struct X *Xp; };", Lang_C);
- Decl *FromTU1 = getTuDecl("struct X {};", Lang_C, "input1.cc");
+ Decl *ToTU = getToTuDecl("struct A { struct X *Xp; };", Lang_C99);
+ Decl *FromTU1 = getTuDecl("struct X {};", Lang_C99, "input1.cc");
auto Pattern = recordDecl(hasName("X"), unless(isImplicit()));
auto ToProto = FirstDeclMatcher<RecordDecl>().match(ToTU, Pattern);
auto FromDef = FirstDeclMatcher<RecordDecl>().match(FromTU1, Pattern);
- Decl *ImportedDef = Import(FromDef, Lang_C);
+ Decl *ImportedDef = Import(FromDef, Lang_C99);
EXPECT_NE(ImportedDef, ToProto);
EXPECT_EQ(DeclCounter<RecordDecl>().match(ToTU, Pattern), 2u);
@@ -3694,13 +3631,13 @@ TEST_P(ImportClasses, ImportDefinitionWhenProtoIsInNestedToContext) {
}
TEST_P(ImportClasses, ImportDefinitionWhenProtoIsInNestedToContextCXX) {
- Decl *ToTU = getToTuDecl("struct A { struct X *Xp; };", Lang_CXX);
- Decl *FromTU1 = getTuDecl("struct X {};", Lang_CXX, "input1.cc");
+ Decl *ToTU = getToTuDecl("struct A { struct X *Xp; };", Lang_CXX03);
+ Decl *FromTU1 = getTuDecl("struct X {};", Lang_CXX03, "input1.cc");
auto Pattern = recordDecl(hasName("X"), unless(isImplicit()));
auto ToProto = FirstDeclMatcher<RecordDecl>().match(ToTU, Pattern);
auto FromDef = FirstDeclMatcher<RecordDecl>().match(FromTU1, Pattern);
- Decl *ImportedDef = Import(FromDef, Lang_CXX);
+ Decl *ImportedDef = Import(FromDef, Lang_CXX03);
EXPECT_NE(ImportedDef, ToProto);
EXPECT_EQ(DeclCounter<RecordDecl>().match(ToTU, Pattern), 2u);
@@ -3712,14 +3649,15 @@ TEST_P(ImportClasses, ImportDefinitionWhenProtoIsInNestedToContextCXX) {
}
TEST_P(ImportClasses, ImportNestedPrototypeThenDefinition) {
- Decl *FromTU0 = getTuDecl("struct A { struct X *Xp; };", Lang_C, "input0.cc");
- Decl *FromTU1 = getTuDecl("struct X {};", Lang_C, "input1.cc");
+ Decl *FromTU0 =
+ getTuDecl("struct A { struct X *Xp; };", Lang_C99, "input0.cc");
+ Decl *FromTU1 = getTuDecl("struct X {};", Lang_C99, "input1.cc");
auto Pattern = recordDecl(hasName("X"), unless(isImplicit()));
auto FromProto = FirstDeclMatcher<RecordDecl>().match(FromTU0, Pattern);
auto FromDef = FirstDeclMatcher<RecordDecl>().match(FromTU1, Pattern);
- Decl *ImportedProto = Import(FromProto, Lang_C);
- Decl *ImportedDef = Import(FromDef, Lang_C);
+ Decl *ImportedProto = Import(FromProto, Lang_C99);
+ Decl *ImportedDef = Import(FromDef, Lang_C99);
Decl *ToTU = ImportedDef->getTranslationUnitDecl();
EXPECT_NE(ImportedDef, ImportedProto);
@@ -3746,7 +3684,7 @@ TEST_P(ImportFriendClasses, ImportOfFriendRecordDoesNotMergeDefinition) {
};
};
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromClass = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("F"), isDefinition()));
@@ -3761,8 +3699,9 @@ TEST_P(ImportFriendClasses, ImportOfFriendRecordDoesNotMergeDefinition) {
ASSERT_EQ(FromFriendClass->getDescribedClassTemplate()->getPreviousDecl(),
FromClass->getDescribedClassTemplate());
- auto *ToClass = cast<CXXRecordDecl>(Import(FromClass, Lang_CXX));
- auto *ToFriendClass = cast<CXXRecordDecl>(Import(FromFriendClass, Lang_CXX));
+ auto *ToClass = cast<CXXRecordDecl>(Import(FromClass, Lang_CXX03));
+ auto *ToFriendClass =
+ cast<CXXRecordDecl>(Import(FromFriendClass, Lang_CXX03));
EXPECT_TRUE(ToClass);
EXPECT_TRUE(ToFriendClass);
@@ -3780,18 +3719,19 @@ TEST_P(ImportFriendClasses, ImportOfRecursiveFriendClass) {
friend class declToImport;
};
)",
- Lang_CXX, "input.cc");
+ Lang_CXX03, "input.cc");
auto *FromD = FirstDeclMatcher<CXXRecordDecl>().match(
FromTu, cxxRecordDecl(hasName("declToImport")));
- auto *ToD = Import(FromD, Lang_CXX);
+ auto *ToD = Import(FromD, Lang_CXX03);
auto Pattern = cxxRecordDecl(has(friendDecl()));
ASSERT_TRUE(MatchVerifier<Decl>{}.match(FromD, Pattern));
EXPECT_TRUE(MatchVerifier<Decl>{}.match(ToD, Pattern));
}
TEST_P(ImportFriendClasses, UndeclaredFriendClassShouldNotBeVisible) {
- Decl *FromTu = getTuDecl("class X { friend class Y; };", Lang_CXX, "from.cc");
+ Decl *FromTu =
+ getTuDecl("class X { friend class Y; };", Lang_CXX03, "from.cc");
auto *FromX = FirstDeclMatcher<CXXRecordDecl>().match(
FromTu, cxxRecordDecl(hasName("X")));
auto *FromFriend = FirstDeclMatcher<FriendDecl>().match(FromTu, friendDecl());
@@ -3809,7 +3749,7 @@ TEST_P(ImportFriendClasses, UndeclaredFriendClassShouldNotBeVisible) {
->lookup(FromRecordOfFriend->getDeclName())
.empty());
- auto *ToX = Import(FromX, Lang_CXX);
+ auto *ToX = Import(FromX, Lang_CXX03);
ASSERT_TRUE(ToX);
Decl *ToTu = ToX->getTranslationUnitDecl();
@@ -3835,11 +3775,11 @@ TEST_P(ImportFriendClasses, ImportOfRecursiveFriendClassTemplate) {
template<class A1> friend class declToImport;
};
)",
- Lang_CXX, "input.cc");
+ Lang_CXX03, "input.cc");
auto *FromD =
FirstDeclMatcher<ClassTemplateDecl>().match(FromTu, classTemplateDecl());
- auto *ToD = Import(FromD, Lang_CXX);
+ auto *ToD = Import(FromD, Lang_CXX03);
auto Pattern = classTemplateDecl(
has(cxxRecordDecl(has(friendDecl(has(classTemplateDecl()))))));
@@ -3860,22 +3800,24 @@ TEST_P(ImportFriendClasses, ProperPrevDeclForClassTemplateDecls) {
{
Decl *FromTU = getTuDecl("template<class T> class X;"
"struct Y { friend class X<int>; };",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match(
FromTU, Pattern);
- Imported1 = cast<ClassTemplateSpecializationDecl>(Import(FromD, Lang_CXX));
+ Imported1 =
+ cast<ClassTemplateSpecializationDecl>(Import(FromD, Lang_CXX03));
}
ClassTemplateSpecializationDecl *Imported2;
{
Decl *FromTU = getTuDecl("template<class T> class X;"
"template<> class X<int>{};"
"struct Z { friend class X<int>; };",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *FromD = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match(
FromTU, Pattern);
- Imported2 = cast<ClassTemplateSpecializationDecl>(Import(FromD, Lang_CXX));
+ Imported2 =
+ cast<ClassTemplateSpecializationDecl>(Import(FromD, Lang_CXX03));
}
Decl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -3896,19 +3838,19 @@ TEST_P(ImportFriendClasses, TypeForDeclShouldBeSetInTemplated) {
friend class F; // The decl context of F is the global namespace.
};
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *Fwd = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU0, classTemplateDecl(hasName("F")));
- auto *Imported0 = cast<ClassTemplateDecl>(Import(Fwd, Lang_CXX));
+ auto *Imported0 = cast<ClassTemplateDecl>(Import(Fwd, Lang_CXX03));
Decl *FromTU1 = getTuDecl(
R"(
template <typename T>
class F {};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *Definition = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU1, classTemplateDecl(hasName("F")));
- auto *Imported1 = cast<ClassTemplateDecl>(Import(Definition, Lang_CXX));
+ auto *Imported1 = cast<ClassTemplateDecl>(Import(Definition, Lang_CXX03));
EXPECT_EQ(Imported0->getTemplatedDecl()->getTypeForDecl(),
Imported1->getTemplatedDecl()->getTypeForDecl());
}
@@ -3916,8 +3858,8 @@ TEST_P(ImportFriendClasses, TypeForDeclShouldBeSetInTemplated) {
TEST_P(ImportFriendClasses, DeclsFromFriendsShouldBeInRedeclChains) {
Decl *From, *To;
std::tie(From, To) =
- getImportedDecl("class declToImport {};", Lang_CXX,
- "class Y { friend class declToImport; };", Lang_CXX);
+ getImportedDecl("class declToImport {};", Lang_CXX03,
+ "class Y { friend class declToImport; };", Lang_CXX03);
auto *Imported = cast<CXXRecordDecl>(To);
EXPECT_TRUE(Imported->getPreviousDecl());
@@ -3935,7 +3877,7 @@ TEST_P(ImportFriendClasses,
friend class F; // The decl context of F is the global namespace.
};
)",
- Lang_CXX);
+ Lang_CXX03);
auto *ToDecl = FirstDeclMatcher<ClassTemplateDecl>().match(
ToTU, classTemplateDecl(hasName("F")));
Decl *FromTU = getTuDecl(
@@ -3943,10 +3885,10 @@ TEST_P(ImportFriendClasses,
template <typename T>
class F {};
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *Definition = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU, classTemplateDecl(hasName("F")));
- auto *ImportedDef = cast<ClassTemplateDecl>(Import(Definition, Lang_CXX));
+ auto *ImportedDef = cast<ClassTemplateDecl>(Import(Definition, Lang_CXX03));
EXPECT_TRUE(ImportedDef->getPreviousDecl());
EXPECT_EQ(ToDecl, ImportedDef->getPreviousDecl());
EXPECT_EQ(ToDecl->getTemplatedDecl(),
@@ -3965,19 +3907,19 @@ TEST_P(ImportFriendClasses,
friend class F; // The decl context of F is the global namespace.
};
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *Fwd = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU0, classTemplateDecl(hasName("F")));
- auto *ImportedFwd = cast<ClassTemplateDecl>(Import(Fwd, Lang_CXX));
+ auto *ImportedFwd = cast<ClassTemplateDecl>(Import(Fwd, Lang_CXX03));
Decl *FromTU1 = getTuDecl(
R"(
template <typename T>
class F {};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *Definition = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU1, classTemplateDecl(hasName("F")));
- auto *ImportedDef = cast<ClassTemplateDecl>(Import(Definition, Lang_CXX));
+ auto *ImportedDef = cast<ClassTemplateDecl>(Import(Definition, Lang_CXX03));
EXPECT_TRUE(ImportedDef->getPreviousDecl());
EXPECT_EQ(ImportedFwd, ImportedDef->getPreviousDecl());
EXPECT_EQ(ImportedFwd->getTemplatedDecl(),
@@ -3994,20 +3936,20 @@ TEST_P(ImportFriendClasses, ImportOfClassDefinitionAndFwdFriendShouldBeLinked) {
friend class F; // The decl context of F is the global namespace.
};
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *Friend = FirstDeclMatcher<FriendDecl>().match(FromTU0, friendDecl());
QualType FT = Friend->getFriendType()->getType();
FT = FromTU0->getASTContext().getCanonicalType(FT);
auto *Fwd = cast<TagType>(FT)->getDecl();
- auto *ImportedFwd = Import(Fwd, Lang_CXX);
+ auto *ImportedFwd = Import(Fwd, Lang_CXX03);
Decl *FromTU1 = getTuDecl(
R"(
class F {};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *Definition = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU1, cxxRecordDecl(hasName("F")));
- auto *ImportedDef = Import(Definition, Lang_CXX);
+ auto *ImportedDef = Import(Definition, Lang_CXX03);
EXPECT_TRUE(ImportedDef->getPreviousDecl());
EXPECT_EQ(ImportedFwd, ImportedDef->getPreviousDecl());
}
@@ -4019,14 +3961,14 @@ TEST_P(ASTImporterOptionSpecificTestBase, FriendFunInClassTemplate) {
friend void foo(){}
};
)";
- TranslationUnitDecl *ToTU = getToTuDecl(Code, Lang_CXX);
+ TranslationUnitDecl *ToTU = getToTuDecl(Code, Lang_CXX03);
auto *ToFoo = FirstDeclMatcher<FunctionDecl>().match(
ToTU, functionDecl(hasName("foo")));
- TranslationUnitDecl *FromTU = getTuDecl(Code, Lang_CXX, "input.cc");
+ TranslationUnitDecl *FromTU = getTuDecl(Code, Lang_CXX03, "input.cc");
auto *FromFoo = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("foo")));
- auto *ImportedFoo = Import(FromFoo, Lang_CXX);
+ auto *ImportedFoo = Import(FromFoo, Lang_CXX03);
EXPECT_EQ(ImportedFoo, ToFoo);
}
@@ -4061,7 +4003,7 @@ TEST_P(DeclContextTest, removeDeclOfClassTemplateSpecialization) {
TEST_P(DeclContextTest,
removeDeclShouldNotFailEvenIfWeHaveExternalVisibleStorage) {
- Decl *TU = getTuDecl("extern int A; int A;", Lang_CXX);
+ Decl *TU = getTuDecl("extern int A; int A;", Lang_CXX03);
auto *A0 = FirstDeclMatcher<VarDecl>().match(TU, varDecl(hasName("A")));
auto *A1 = LastDeclMatcher<VarDecl>().match(TU, varDecl(hasName("A")));
@@ -4105,7 +4047,7 @@ TEST_P(ImportFunctionTemplateSpecializations,
int f() { return 0; }
void foo() { f<int>(); }
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
// Check that the function template instantiation is NOT the child of the TU.
auto Pattern = translationUnitDecl(
@@ -4114,7 +4056,7 @@ TEST_P(ImportFunctionTemplateSpecializations,
auto *Foo = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("foo")));
- ASSERT_TRUE(Import(Foo, Lang_CXX));
+ ASSERT_TRUE(Import(Foo, Lang_CXX03));
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
EXPECT_TRUE(MatchVerifier<Decl>{}.match(ToTU, Pattern));
@@ -4129,15 +4071,15 @@ TEST_P(ImportFunctionTemplateSpecializations,
int f() { return 0; }
template int f<int>();
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
// Check that the function template instantiation is NOT the child of the TU.
auto Instantiation = functionDecl(hasName("f"), isTemplateInstantiation());
auto Pattern = translationUnitDecl(unless(has(Instantiation)));
ASSERT_TRUE(MatchVerifier<Decl>{}.match(FromTU, Pattern));
- ASSERT_TRUE(
- Import(FirstDeclMatcher<Decl>().match(FromTU, Instantiation), Lang_CXX));
+ ASSERT_TRUE(Import(FirstDeclMatcher<Decl>().match(FromTU, Instantiation),
+ Lang_CXX03));
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
EXPECT_TRUE(MatchVerifier<Decl>{}.match(ToTU, Pattern));
@@ -4152,7 +4094,7 @@ TEST_P(ImportFunctionTemplateSpecializations,
int f() { return 0; }
template <> int f<int>() { return 4; }
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
// Check that the function template specialization is the child of the TU.
auto Specialization =
@@ -4160,8 +4102,8 @@ TEST_P(ImportFunctionTemplateSpecializations,
auto Pattern = translationUnitDecl(has(Specialization));
ASSERT_TRUE(MatchVerifier<Decl>{}.match(FromTU, Pattern));
- ASSERT_TRUE(
- Import(FirstDeclMatcher<Decl>().match(FromTU, Specialization), Lang_CXX));
+ ASSERT_TRUE(Import(FirstDeclMatcher<Decl>().match(FromTU, Specialization),
+ Lang_CXX03));
auto *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
EXPECT_TRUE(MatchVerifier<Decl>{}.match(ToTU, Pattern));
@@ -4176,7 +4118,7 @@ TEST_P(ImportFunctionTemplateSpecializations,
int f() { return 0; }
template <> int f<int>() { return 4; }
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto Spec = functionDecl(hasName("f"), isExplicitTemplateSpecialization(),
hasParent(translationUnitDecl()));
@@ -4193,7 +4135,7 @@ TEST_P(ImportFunctionTemplateSpecializations,
->doesThisDeclarationHaveABody());
}
- ASSERT_TRUE(Import(FromSpecD, Lang_CXX));
+ ASSERT_TRUE(Import(FromSpecD, Lang_CXX03));
{
auto *TU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -4239,11 +4181,11 @@ TEST_P(ASTImporterOptionSpecificTestBase,
template <typename T>
struct B;
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromD = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU, classTemplateDecl(hasName("B")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
}
{
@@ -4255,13 +4197,13 @@ TEST_P(ASTImporterOptionSpecificTestBase,
B* b;
};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
FunctionDecl *FromD = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
- Import(FromD, Lang_CXX);
+ Import(FromD, Lang_CXX03);
auto *FromCTD = FirstDeclMatcher<ClassTemplateDecl>().match(
FromTU, classTemplateDecl(hasName("B")));
- auto *ToCTD = cast<ClassTemplateDecl>(Import(FromCTD, Lang_CXX));
+ auto *ToCTD = cast<ClassTemplateDecl>(Import(FromCTD, Lang_CXX03));
EXPECT_TRUE(ToCTD->isThisDeclarationADefinition());
// We expect no (ODR) warning during the import.
@@ -4311,12 +4253,12 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportTemplateParameterLists) {
template <> int f<int>() { return 4; }
)";
- Decl *FromTU = getTuDecl(Code, Lang_CXX);
+ Decl *FromTU = getTuDecl(Code, Lang_CXX03);
auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU,
functionDecl(hasName("f"), isExplicitTemplateSpecialization()));
ASSERT_EQ(FromD->getNumTemplateParameterLists(), 1u);
- auto *ToD = Import(FromD, Lang_CXX);
+ auto *ToD = Import(FromD, Lang_CXX03);
// The template parameter list should exist.
EXPECT_EQ(ToD->getNumTemplateParameterLists(), 1u);
}
@@ -4324,7 +4266,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportTemplateParameterLists) {
struct ASTImporterLookupTableTest : ASTImporterOptionSpecificTestBase {};
TEST_P(ASTImporterLookupTableTest, OneDecl) {
- auto *ToTU = getToTuDecl("int a;", Lang_CXX);
+ auto *ToTU = getToTuDecl("int a;", Lang_CXX03);
auto *D = FirstDeclMatcher<VarDecl>().match(ToTU, varDecl(hasName("a")));
ASTImporterLookupTable LT(*ToTU);
auto Res = LT.lookup(ToTU, D->getDeclName());
@@ -4349,7 +4291,7 @@ TEST_P(ASTImporterLookupTableTest,
friend void foo(){}
};
)";
- TranslationUnitDecl *ToTU = getToTuDecl(Code, Lang_CXX);
+ TranslationUnitDecl *ToTU = getToTuDecl(Code, Lang_CXX03);
auto *X = FirstDeclMatcher<ClassTemplateDecl>().match(
ToTU, classTemplateDecl(hasName("X")));
auto *Foo = FirstDeclMatcher<FunctionDecl>().match(
@@ -4385,7 +4327,7 @@ TEST_P(ASTImporterLookupTableTest,
TEST_P(ASTImporterLookupTableTest,
FwdDeclStructShouldBeFoundByImporterSpecificLookup) {
TranslationUnitDecl *ToTU =
- getToTuDecl("struct A { struct Foo *p; };", Lang_C);
+ getToTuDecl("struct A { struct Foo *p; };", Lang_C99);
auto *Foo =
FirstDeclMatcher<RecordDecl>().match(ToTU, recordDecl(hasName("Foo")));
auto *A =
@@ -4420,7 +4362,7 @@ TEST_P(ASTImporterLookupTableTest,
TEST_P(ASTImporterLookupTableTest, LookupFindsNamesInDifferentDC) {
TranslationUnitDecl *ToTU =
- getToTuDecl("int V; struct A { int V; }; struct B { int V; };", Lang_C);
+ getToTuDecl("int V; struct A { int V; }; struct B { int V; };", Lang_C99);
DeclarationName VName = FirstDeclMatcher<VarDecl>()
.match(ToTU, varDecl(hasName("V")))
->getDeclName();
@@ -4455,7 +4397,7 @@ TEST_P(ASTImporterLookupTableTest, LookupFindsOverloadedNames) {
void foo(int);
void foo(int, int);
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *F0 = FirstDeclMatcher<FunctionDecl>().match(ToTU, functionDecl());
@@ -4475,7 +4417,7 @@ TEST_P(ASTImporterLookupTableTest,
void operator+(X, X);
void operator-(X, X);
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *FPlus = FirstDeclMatcher<FunctionDecl>().match(
@@ -4501,7 +4443,7 @@ TEST_P(ASTImporterLookupTableTest, LookupDeclNamesFromDifferentTUs) {
struct X {};
void operator+(X, X);
)",
- Lang_CXX);
+ Lang_CXX03);
auto *ToPlus = FirstDeclMatcher<FunctionDecl>().match(
ToTU, functionDecl(hasOverloadedOperatorName("+")));
@@ -4510,7 +4452,7 @@ TEST_P(ASTImporterLookupTableTest, LookupDeclNamesFromDifferentTUs) {
struct X {};
void operator+(X, X);
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromPlus = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasOverloadedOperatorName("+")));
@@ -4533,7 +4475,7 @@ TEST_P(ASTImporterLookupTableTest,
R"(
class Y { friend class F; };
)",
- Lang_CXX);
+ Lang_CXX03);
// In this case, the CXXRecordDecl is hidden, the FriendDecl is not a parent.
// So we must dig up the underlying CXXRecordDecl.
@@ -4603,7 +4545,7 @@ TEST_P(ASTImporterLookupTableTest, LookupFindsFwdFriendClassTemplateDecl) {
R"(
class Y { template <class T> friend class F; };
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *F = FirstDeclMatcher<ClassTemplateDecl>().match(
@@ -4626,7 +4568,7 @@ TEST_P(ASTImporterLookupTableTest, DependentFriendClass) {
friend class F<T>;
};
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *F = FirstDeclMatcher<ClassTemplateDecl>().match(
@@ -4648,7 +4590,7 @@ TEST_P(ASTImporterLookupTableTest, FriendClassTemplateSpecialization) {
friend class F<int>;
};
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *F = FirstDeclMatcher<ClassTemplateDecl>().match(
@@ -4666,7 +4608,7 @@ TEST_P(ASTImporterLookupTableTest, LookupFindsFwdFriendFunctionDecl) {
R"(
class Y { friend void F(); };
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *F =
@@ -4689,7 +4631,7 @@ TEST_P(ASTImporterLookupTableTest,
X<char> xc;
}
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
@@ -4731,7 +4673,7 @@ TEST_P(ASTImporterLookupTableTest, LookupFindsFwdFriendFunctionTemplateDecl) {
R"(
class Y { template <class T> friend void F(); };
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *F = FirstDeclMatcher<FunctionTemplateDecl>().match(
@@ -4754,7 +4696,7 @@ TEST_P(ASTImporterLookupTableTest, MultipleBefriendingClasses) {
friend struct X;
};
)",
- Lang_CXX);
+ Lang_CXX03);
ASTImporterLookupTable LT(*ToTU);
auto *X = FirstDeclMatcher<CXXRecordDecl>().match(
@@ -4780,7 +4722,7 @@ TEST_P(ASTImporterLookupTableTest, EnumConstantDecl) {
B
};
)",
- Lang_C);
+ Lang_C99);
ASTImporterLookupTable LT(*ToTU);
auto *E = FirstDeclMatcher<EnumDecl>().match(ToTU, enumDecl(hasName("E")));
@@ -4820,7 +4762,7 @@ TEST_P(ASTImporterLookupTableTest, LookupSearchesInTheWholeRedeclChain) {
namespace N {
}
)",
- Lang_CXX);
+ Lang_CXX03);
auto *N1 =
LastDeclMatcher<NamespaceDecl>().match(ToTU, namespaceDecl(hasName("N")));
auto *A = FirstDeclMatcher<VarDecl>().match(ToTU, varDecl(hasName("A")));
@@ -4849,7 +4791,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
};
}
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromFwd = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("X"), unless(isImplicit())));
auto *FromDef = LastDeclMatcher<CXXRecordDecl>().match(
@@ -4860,8 +4802,8 @@ TEST_P(ASTImporterOptionSpecificTestBase,
ASSERT_TRUE(FromDef->isThisDeclarationADefinition());
ASSERT_EQ(FromFwd->getCanonicalDecl(), FromDef->getCanonicalDecl());
- auto *ToDef = cast_or_null<CXXRecordDecl>(Import(FromDef, Lang_CXX));
- auto *ToFwd = cast_or_null<CXXRecordDecl>(Import(FromFwd, Lang_CXX));
+ auto *ToDef = cast_or_null<CXXRecordDecl>(Import(FromDef, Lang_CXX03));
+ auto *ToFwd = cast_or_null<CXXRecordDecl>(Import(FromFwd, Lang_CXX03));
EXPECT_NE(ToFwd, ToDef);
EXPECT_FALSE(ToFwd->isThisDeclarationADefinition());
EXPECT_TRUE(ToDef->isThisDeclarationADefinition());
@@ -4880,7 +4822,7 @@ TEST_P(ImportFriendFunctionTemplates, LookupShouldFindPreviousFriend) {
template <typename T> friend void foo();
};
)",
- Lang_CXX);
+ Lang_CXX03);
auto *Friend = FirstDeclMatcher<FunctionTemplateDecl>().match(
ToTU, functionTemplateDecl(hasName("foo")));
@@ -4888,10 +4830,10 @@ TEST_P(ImportFriendFunctionTemplates, LookupShouldFindPreviousFriend) {
R"(
template <typename T> void foo();
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromFoo = FirstDeclMatcher<FunctionTemplateDecl>().match(
FromTU, functionTemplateDecl(hasName("foo")));
- auto *Imported = Import(FromFoo, Lang_CXX);
+ auto *Imported = Import(FromFoo, Lang_CXX03);
EXPECT_EQ(Imported->getPreviousDecl(), Friend);
}
@@ -4927,7 +4869,7 @@ TEST_P(ErrorHandlingTest, ErrorHappensBeforeCreatingANewNode) {
template <>
class X<int> { int a; };
)",
- Lang_CXX);
+ Lang_CXX03);
TranslationUnitDecl *FromTU = getTuDecl(
R"(
template <typename T>
@@ -4935,10 +4877,10 @@ TEST_P(ErrorHandlingTest, ErrorHappensBeforeCreatingANewNode) {
template <>
class X<int> { double b; };
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromSpec = FirstDeclMatcher<ClassTemplateSpecializationDecl>().match(
FromTU, classTemplateSpecializationDecl(hasName("X")));
- ClassTemplateSpecializationDecl *ImportedSpec = Import(FromSpec, Lang_CXX);
+ ClassTemplateSpecializationDecl *ImportedSpec = Import(FromSpec, Lang_CXX03);
EXPECT_FALSE(ImportedSpec);
// The original Decl is kept, no new decl is created.
@@ -4958,12 +4900,11 @@ TEST_P(ErrorHandlingTest, ErrorHappensBeforeCreatingANewNode) {
TEST_P(ErrorHandlingTest,
ErrorHappensAfterCreatingTheNodeButBeforeLinkingThatToTheAST) {
TranslationUnitDecl *FromTU = getTuDecl(
- std::string("void foo() { ") + ErroneousStmt + " }",
- Lang_CXX);
+ std::string("void foo() { ") + ErroneousStmt + " }", Lang_CXX03);
auto *FromFoo = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("foo")));
- FunctionDecl *ImportedFoo = Import(FromFoo, Lang_CXX);
+ FunctionDecl *ImportedFoo = Import(FromFoo, Lang_CXX03);
EXPECT_FALSE(ImportedFoo);
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
@@ -4982,17 +4923,16 @@ TEST_P(ErrorHandlingTest,
// encountering the error. The error is set for the counterpart of the nodes in
// the "from" context.
TEST_P(ErrorHandlingTest, ErrorHappensAfterNodeIsCreatedAndLinked) {
- TranslationUnitDecl *FromTU = getTuDecl(
- std::string(R"(
+ TranslationUnitDecl *FromTU = getTuDecl(std::string(R"(
void f();
void f() { )") + ErroneousStmt + R"( }
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromProto = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
auto *FromDef =
LastDeclMatcher<FunctionDecl>().match(FromTU, functionDecl(hasName("f")));
- FunctionDecl *ImportedProto = Import(FromProto, Lang_CXX);
+ FunctionDecl *ImportedProto = Import(FromProto, Lang_CXX03);
EXPECT_FALSE(ImportedProto); // Could not import.
// However, we created two nodes in the AST. 1) the fwd decl 2) the
// definition. The definition is not added to its DC, but the fwd decl is
@@ -5017,18 +4957,17 @@ TEST_P(ErrorHandlingTest, ErrorHappensAfterNodeIsCreatedAndLinked) {
// An error should be set for a class if we cannot import one member.
TEST_P(ErrorHandlingTest, ErrorIsPropagatedFromMemberToClass) {
- TranslationUnitDecl *FromTU = getTuDecl(
- std::string(R"(
+ TranslationUnitDecl *FromTU = getTuDecl(std::string(R"(
class X {
void f() { )") + ErroneousStmt + R"( } // This member has the error
// during import.
void ok(); // The error should not prevent importing this.
}; // An error will be set for X too.
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromX = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("X")));
- CXXRecordDecl *ImportedX = Import(FromX, Lang_CXX);
+ CXXRecordDecl *ImportedX = Import(FromX, Lang_CXX03);
// An error is set for X.
EXPECT_FALSE(ImportedX);
@@ -5044,7 +4983,7 @@ TEST_P(ErrorHandlingTest, ErrorIsPropagatedFromMemberToClass) {
ASSERT_TRUE(OptErr);
EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct);
// And any subsequent import should fail.
- CXXMethodDecl *ImportedF = Import(FromF, Lang_CXX);
+ CXXMethodDecl *ImportedF = Import(FromF, Lang_CXX03);
EXPECT_FALSE(ImportedF);
// There is an error set for the other member too.
@@ -5053,7 +4992,7 @@ TEST_P(ErrorHandlingTest, ErrorIsPropagatedFromMemberToClass) {
OptErr = Importer->getImportDeclErrorIfAny(FromOK);
EXPECT_TRUE(OptErr);
// Cannot import the other member.
- CXXMethodDecl *ImportedOK = Import(FromOK, Lang_CXX);
+ CXXMethodDecl *ImportedOK = Import(FromOK, Lang_CXX03);
EXPECT_FALSE(ImportedOK);
}
@@ -5063,21 +5002,21 @@ TEST_P(ErrorHandlingTest, ErrorIsPropagatedFromMemberToClass) {
// And to all AST nodes which we visit during the import process which finally
// ends up in a failure (in the error() function).
TEST_P(ErrorHandlingTest, ErrorPropagatesThroughImportCycles) {
- Decl *FromTU = getTuDecl(
- std::string(R"(
+ Decl *FromTU = getTuDecl(std::string(R"(
namespace NS {
class A {
template <int I> class F {};
class X {
template <int I> friend class F;
- void error() { )") + ErroneousStmt + R"( }
+ void error() { )") +
+ ErroneousStmt + R"( }
};
};
class B {};
} // NS
)",
- Lang_CXX, "input0.cc");
+ Lang_CXX03, "input0.cc");
auto *FromFRD = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("F"), isDefinition()));
@@ -5090,13 +5029,13 @@ TEST_P(ErrorHandlingTest, ErrorPropagatesThroughImportCycles) {
// Start by importing the templated CXXRecordDecl of F.
// Import fails for that.
- EXPECT_FALSE(Import(FromFRD, Lang_CXX));
+ EXPECT_FALSE(Import(FromFRD, Lang_CXX03));
// Import fails for A.
- EXPECT_FALSE(Import(FromA, Lang_CXX));
+ EXPECT_FALSE(Import(FromA, Lang_CXX03));
// But we should be able to import the independent B.
- EXPECT_TRUE(Import(FromB, Lang_CXX));
+ EXPECT_TRUE(Import(FromB, Lang_CXX03));
// And the namespace.
- EXPECT_TRUE(Import(FromNS, Lang_CXX));
+ EXPECT_TRUE(Import(FromNS, Lang_CXX03));
// An error is set to the templated CXXRecordDecl of F.
ASTImporter *Importer = findFromTU(FromFRD)->Importer.get();
@@ -5143,18 +5082,17 @@ TEST_P(ErrorHandlingTest, ErrorPropagatesThroughImportCycles) {
}
TEST_P(ErrorHandlingTest, ErrorIsNotPropagatedFromMemberToNamespace) {
- TranslationUnitDecl *FromTU = getTuDecl(
- std::string(R"(
+ TranslationUnitDecl *FromTU = getTuDecl(std::string(R"(
namespace X {
void f() { )") + ErroneousStmt + R"( } // This member has the error
// during import.
void ok(); // The error should not prevent importing this.
}; // An error will be set for X too.
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromX = FirstDeclMatcher<NamespaceDecl>().match(
FromTU, namespaceDecl(hasName("X")));
- NamespaceDecl *ImportedX = Import(FromX, Lang_CXX);
+ NamespaceDecl *ImportedX = Import(FromX, Lang_CXX03);
// There is no error set for X.
EXPECT_TRUE(ImportedX);
@@ -5169,7 +5107,7 @@ TEST_P(ErrorHandlingTest, ErrorIsNotPropagatedFromMemberToNamespace) {
ASSERT_TRUE(OptErr);
EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct);
// And any subsequent import should fail.
- FunctionDecl *ImportedF = Import(FromF, Lang_CXX);
+ FunctionDecl *ImportedF = Import(FromF, Lang_CXX03);
EXPECT_FALSE(ImportedF);
// There is no error set for ok().
@@ -5178,7 +5116,7 @@ TEST_P(ErrorHandlingTest, ErrorIsNotPropagatedFromMemberToNamespace) {
OptErr = Importer->getImportDeclErrorIfAny(FromOK);
EXPECT_FALSE(OptErr);
// And we should be able to import.
- FunctionDecl *ImportedOK = Import(FromOK, Lang_CXX);
+ FunctionDecl *ImportedOK = Import(FromOK, Lang_CXX03);
EXPECT_TRUE(ImportedOK);
}
@@ -5187,8 +5125,7 @@ TEST_P(ErrorHandlingTest, ErrorIsNotPropagatedFromMemberToNamespace) {
TEST_P(ErrorHandlingTest,
ImportedDeclWithErrorShouldFailTheImportOfDeclWhichMapToIt) {
// We already have a fwd decl.
- TranslationUnitDecl *ToTU = getToTuDecl(
- "class X;", Lang_CXX);
+ TranslationUnitDecl *ToTU = getToTuDecl("class X;", Lang_CXX03);
// Then we import a definition.
{
TranslationUnitDecl *FromTU = getTuDecl(std::string(R"(
@@ -5197,10 +5134,10 @@ TEST_P(ErrorHandlingTest,
void ok();
};
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromX = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("X")));
- CXXRecordDecl *ImportedX = Import(FromX, Lang_CXX);
+ CXXRecordDecl *ImportedX = Import(FromX, Lang_CXX03);
// An error is set for X ...
EXPECT_FALSE(ImportedX);
@@ -5232,11 +5169,11 @@ TEST_P(ErrorHandlingTest,
void ok();
};
)",
- Lang_CXX, "input1.cc");
+ Lang_CXX03, "input1.cc");
auto *FromX = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("X")));
- CXXRecordDecl *ImportedX = Import(FromX, Lang_CXX);
+ CXXRecordDecl *ImportedX = Import(FromX, Lang_CXX03);
// If we did not save the errors for the "to" context then the below checks
// would fail, because the lookup finds the fwd Decl of the existing
@@ -5367,8 +5304,8 @@ TEST_P(ASTImporterOptionSpecificTestBase,
struct Class { };
)";
- TranslationUnitDecl *ToTU = getToTuDecl(Code, Lang_CXX);
- TranslationUnitDecl *FromTU = getTuDecl(Code, Lang_CXX, "input.cc");
+ TranslationUnitDecl *ToTU = getToTuDecl(Code, Lang_CXX03);
+ TranslationUnitDecl *FromTU = getTuDecl(Code, Lang_CXX03, "input.cc");
auto *ToClassProto = FirstDeclMatcher<ClassTemplateDecl>().match(
ToTU, classTemplateDecl(hasName("Class")));
@@ -5391,7 +5328,7 @@ TEST_P(ASTImporterOptionSpecificTestBase,
ASSERT_EQ(FromClassDef->getMostRecentDecl(), FromClassDef);
ASSERT_EQ(FromClassProto->getMostRecentDecl(), FromClassProto);
- auto *ImportedDef = Import(FromClassDef, Lang_CXX);
+ auto *ImportedDef = Import(FromClassDef, Lang_CXX03);
// At import we should find the definition for 'Class' even if the
// prototype (inside 'friend') for it comes first in the AST and is not
// linked to the definition.
@@ -5419,7 +5356,7 @@ TEST_P(LLDBLookupTest, ImporterShouldFindInTransparentContext) {
class X{};
};
)",
- Lang_CXX);
+ Lang_CXX03);
auto *ToX = FirstDeclMatcher<CXXRecordDecl>().match(
ToTU, cxxRecordDecl(hasName("X")));
@@ -5434,10 +5371,10 @@ TEST_P(LLDBLookupTest, ImporterShouldFindInTransparentContext) {
R"(
class X;
)",
- Lang_CXX);
+ Lang_CXX03);
auto *FromX = FirstDeclMatcher<CXXRecordDecl>().match(
FromTU, cxxRecordDecl(hasName("X")));
- auto *ImportedX = Import(FromX, Lang_CXX);
+ auto *ImportedX = Import(FromX, Lang_CXX03);
// The lookup must find the existing class definition in the LinkageSpecDecl.
// Then the importer renders the existing and the new decl into one chain.
EXPECT_EQ(ImportedX->getCanonicalDecl(), ToX->getCanonicalDecl());
@@ -5461,8 +5398,8 @@ TEST_P(SVEBuiltins, ImportTypes) {
"__SVBool_t"
};
- TranslationUnitDecl *ToTU = getToTuDecl("", Lang_CXX);
- TranslationUnitDecl *FromTU = getTuDecl("", Lang_CXX, "input.cc");
+ TranslationUnitDecl *ToTU = getToTuDecl("", Lang_CXX03);
+ TranslationUnitDecl *FromTU = getTuDecl("", Lang_CXX03, "input.cc");
for (auto *TypeName : TypeNames) {
auto *ToTypedef = FirstDeclMatcher<TypedefDecl>().match(
ToTU, typedefDecl(hasName(TypeName)));
@@ -5472,7 +5409,7 @@ TEST_P(SVEBuiltins, ImportTypes) {
FromTU, typedefDecl(hasName(TypeName)));
QualType FromType = FromTypedef->getUnderlyingType();
- QualType ImportedType = ImportType(FromType, FromTypedef, Lang_CXX);
+ QualType ImportedType = ImportType(FromType, FromTypedef, Lang_CXX03);
EXPECT_EQ(ImportedType, ToType);
}
}
@@ -5606,7 +5543,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportAssignedLambda) {
auto x = []{} = {}; auto x2 = x;
}
)",
- Lang_CXX2a, "input0.cc");
+ Lang_CXX20, "input0.cc");
auto FromF = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
// We have only one lambda class.
@@ -5614,7 +5551,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportAssignedLambda) {
DeclCounter<CXXRecordDecl>().match(FromTU, cxxRecordDecl(isLambda())),
1u);
- FunctionDecl *ToF = Import(FromF, Lang_CXX2a);
+ FunctionDecl *ToF = Import(FromF, Lang_CXX20);
EXPECT_TRUE(ToF);
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
// We have only one lambda class after the import.
@@ -5630,7 +5567,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportDefaultConstructibleLambdas) {
auto xb = []{} = {};
}
)",
- Lang_CXX2a, "input0.cc");
+ Lang_CXX20, "input0.cc");
auto FromF = FirstDeclMatcher<FunctionDecl>().match(
FromTU, functionDecl(hasName("f")));
// We have two lambda classes.
@@ -5638,7 +5575,7 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportDefaultConstructibleLambdas) {
DeclCounter<CXXRecordDecl>().match(FromTU, cxxRecordDecl(isLambda())),
2u);
- FunctionDecl *ToF = Import(FromF, Lang_CXX2a);
+ FunctionDecl *ToF = Import(FromF, Lang_CXX20);
EXPECT_TRUE(ToF);
TranslationUnitDecl *ToTU = ToAST->getASTContext().getTranslationUnitDecl();
// We have two lambda classes after the import.
@@ -5862,18 +5799,18 @@ TEST_P(ImportSourceLocations, PreserveFileIDTreeStructure) {
SourceLocation Location1;
{
auto Pattern = varDecl(hasName("X"));
- Decl *FromTU = getTuDecl("int X;", Lang_C, "input0.c");
+ Decl *FromTU = getTuDecl("int X;", Lang_C99, "input0.c");
auto *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
- Location1 = Import(FromD, Lang_C)->getLocation();
+ Location1 = Import(FromD, Lang_C99)->getLocation();
}
SourceLocation Location2;
{
auto Pattern = varDecl(hasName("Y"));
- Decl *FromTU = getTuDecl("int Y;", Lang_C, "input1.c");
+ Decl *FromTU = getTuDecl("int Y;", Lang_C99, "input1.c");
auto *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
- Location2 = Import(FromD, Lang_C)->getLocation();
+ Location2 = Import(FromD, Lang_C99)->getLocation();
}
SourceManager &ToSM = ToAST->getSourceManager();
@@ -5899,14 +5836,14 @@ TEST_P(ImportSourceLocations, NormalFileBuffer) {
std::string Path = "input0.c";
std::string Source = "int X;";
- TranslationUnitDecl *FromTU = getTuDecl(Source, Lang_C, Path);
+ TranslationUnitDecl *FromTU = getTuDecl(Source, Lang_C99, Path);
SourceLocation ImportedLoc;
{
// Import the VarDecl to trigger the importing of the FileID.
auto Pattern = varDecl(hasName("X"));
VarDecl *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
- ImportedLoc = Import(FromD, Lang_C)->getLocation();
+ ImportedLoc = Import(FromD, Lang_C99)->getLocation();
}
// Make sure the imported buffer has the original contents.
@@ -5919,7 +5856,7 @@ TEST_P(ImportSourceLocations, OverwrittenFileBuffer) {
// Test importing overwritten file buffers.
std::string Path = "input0.c";
- TranslationUnitDecl *FromTU = getTuDecl("int X;", Lang_C, Path);
+ TranslationUnitDecl *FromTU = getTuDecl("int X;", Lang_C99, Path);
// Overwrite the file buffer for our input file with new content.
const std::string Contents = "overwritten contents";
@@ -5939,7 +5876,7 @@ TEST_P(ImportSourceLocations, OverwrittenFileBuffer) {
// Import the VarDecl to trigger the importing of the FileID.
auto Pattern = varDecl(hasName("X"));
VarDecl *FromD = FirstDeclMatcher<VarDecl>().match(FromTU, Pattern);
- ImportedLoc = Import(FromD, Lang_C)->getLocation();
+ ImportedLoc = Import(FromD, Lang_C99)->getLocation();
}
// Make sure the imported buffer has the overwritten contents.
@@ -6024,7 +5961,7 @@ struct SourceWithCompletedTagList : clang::ExternalASTSource {
TEST_P(ImportWithExternalSource, CompleteRecordBeforeImporting) {
// Create an empty TU.
- TranslationUnitDecl *FromTU = getTuDecl("", Lang_CXX, "input.cpp");
+ TranslationUnitDecl *FromTU = getTuDecl("", Lang_CXX03, "input.cpp");
// Create and add the test ExternalASTSource.
std::vector<clang::TagDecl *> CompletedTags;
@@ -6042,7 +5979,7 @@ TEST_P(ImportWithExternalSource, CompleteRecordBeforeImporting) {
// Do a minimal import of the created class.
EXPECT_EQ(0U, CompletedTags.size());
- Import(Record, Lang_CXX);
+ Import(Record, Lang_CXX03);
EXPECT_EQ(0U, CompletedTags.size());
// Import the definition of the created class.
diff --git a/clang/unittests/AST/MatchVerifier.h b/clang/unittests/AST/MatchVerifier.h
index 865b03a7e80e..3fb22ef00f98 100644
--- a/clang/unittests/AST/MatchVerifier.h
+++ b/clang/unittests/AST/MatchVerifier.h
@@ -36,7 +36,7 @@ class MatchVerifier : public MatchFinder::MatchCallback {
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:
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index ef82a02aca75..cb96afed64d3 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -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(
diff --git a/clang/unittests/AST/StructuralEquivalenceTest.cpp b/clang/unittests/AST/StructuralEquivalenceTest.cpp
index 3cb4afedd4db..08512d606279 100644
--- a/clang/unittests/AST/StructuralEquivalenceTest.cpp
+++ b/clang/unittests/AST/StructuralEquivalenceTest.cpp
@@ -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(),
diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp
index 705cb872c6a4..bcfb2f7614e8 100644
--- a/clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -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";
More information about the cfe-commits
mailing list