[cfe-commits] r162974 - /cfe/trunk/unittests/AST/DeclPrinterTest.cpp
Dmitri Gribenko
gribozavr at gmail.com
Thu Aug 30 20:05:44 PDT 2012
Author: gribozavr
Date: Thu Aug 30 22:05:44 2012
New Revision: 162974
URL: http://llvm.org/viewvc/llvm-project?rev=162974&view=rev
Log:
DeclPrinter tests: since now some platforms use C++11 by default, make it
explicitly visible in test cases which language variant is used.
Modified:
cfe/trunk/unittests/AST/DeclPrinterTest.cpp
Modified: cfe/trunk/unittests/AST/DeclPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclPrinterTest.cpp?rev=162974&r1=162973&r2=162974&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/DeclPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/DeclPrinterTest.cpp Thu Aug 30 22:05:44 2012
@@ -73,8 +73,6 @@
std::vector<std::string> ArgVector;
ArgVector.push_back("clang-tool");
ArgVector.push_back("-fsyntax-only");
- // operator delete (void*) grows a "noexcept" in c++11.
- ArgVector.push_back("-std=c++98");
ArgVector.push_back(FileNameRef.data());
for (unsigned i = 0, e = ClangArgs.size(); i != e; ++i)
ArgVector.push_back(ClangArgs[i]);
@@ -118,21 +116,21 @@
return ::testing::AssertionSuccess();
}
-::testing::AssertionResult PrintedDeclMatches(StringRef Code,
- StringRef DeclName,
- StringRef ExpectedPrinted) {
+::testing::AssertionResult PrintedDeclCXX98Matches(StringRef Code,
+ StringRef DeclName,
+ StringRef ExpectedPrinted) {
return PrintedDeclMatches(Code,
- ArrayRef<const char *>(),
+ ArrayRef<const char *>("-std=c++98"),
namedDecl(hasName(DeclName)).bind("id"),
ExpectedPrinted);
}
-::testing::AssertionResult PrintedDeclMatches(
+::testing::AssertionResult PrintedDeclCXX98Matches(
StringRef Code,
const DeclarationMatcher &NodeMatch,
StringRef ExpectedPrinted) {
return PrintedDeclMatches(Code,
- ArrayRef<const char *>(),
+ ArrayRef<const char *>("-std=c++98"),
NodeMatch,
ExpectedPrinted);
}
@@ -159,7 +157,7 @@
} // unnamed namespace
TEST(DeclPrinter, TestNamespace1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"namespace A { int B; }",
"A",
"namespace A {\n}"));
@@ -175,7 +173,7 @@
}
TEST(DeclPrinter, TestNamespaceAlias1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"namespace Z { }"
"namespace A = Z;",
"A",
@@ -184,7 +182,7 @@
}
TEST(DeclPrinter, TestNamespaceAlias2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"namespace X { namespace Y {} }"
"namespace A = X::Y;",
"A",
@@ -193,7 +191,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class A { int a; };",
"A",
"class A {\n}"));
@@ -201,7 +199,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A { int a; };",
"A",
"struct A {\n}"));
@@ -209,7 +207,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"union A { int a; };",
"A",
"union A {\n}"));
@@ -217,7 +215,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl4) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class Z { int a; };"
"class A : Z { int b; };",
"A",
@@ -226,7 +224,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl5) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z { int a; };"
"struct A : Z { int b; };",
"A",
@@ -235,7 +233,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl6) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class Z { int a; };"
"class A : public Z { int b; };",
"A",
@@ -244,7 +242,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl7) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class Z { int a; };"
"class A : protected Z { int b; };",
"A",
@@ -253,7 +251,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl8) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class Z { int a; };"
"class A : private Z { int b; };",
"A",
@@ -262,7 +260,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl9) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class Z { int a; };"
"class A : virtual Z { int b; };",
"A",
@@ -271,7 +269,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl10) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class Z { int a; };"
"class A : virtual public Z { int b; };",
"A",
@@ -280,7 +278,7 @@
}
TEST(DeclPrinter, TestCXXRecordDecl11) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class Z { int a; };"
"class Y : virtual public Z { int b; };"
"class A : virtual public Z, private Y { int c; };",
@@ -290,7 +288,7 @@
}
TEST(DeclPrinter, TestFunctionDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void A();",
"A",
"void A()"));
@@ -298,7 +296,7 @@
}
TEST(DeclPrinter, TestFunctionDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void A() {}",
"A",
"void A()"));
@@ -306,7 +304,7 @@
}
TEST(DeclPrinter, TestFunctionDecl3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void Z();"
"void A() { Z(); }",
"A",
@@ -315,7 +313,7 @@
}
TEST(DeclPrinter, TestFunctionDecl4) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"extern void A();",
"A",
"extern void A()"));
@@ -323,7 +321,7 @@
}
TEST(DeclPrinter, TestFunctionDecl5) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"static void A();",
"A",
"static void A()"));
@@ -331,7 +329,7 @@
}
TEST(DeclPrinter, TestFunctionDecl6) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"inline void A();",
"A",
"inline void A()"));
@@ -347,7 +345,7 @@
}
TEST(DeclPrinter, TestFunctionDecl8) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void A(int a);",
"A",
"void A(int a)"));
@@ -355,7 +353,7 @@
}
TEST(DeclPrinter, TestFunctionDecl9) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void A(...);",
"A",
"void A(...)"));
@@ -363,7 +361,7 @@
}
TEST(DeclPrinter, TestFunctionDecl10) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void A(int a, ...);",
"A",
"void A(int a, ...)"));
@@ -371,7 +369,7 @@
}
TEST(DeclPrinter, TestFunctionDecl11) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"typedef long size_t;"
"typedef int *pInt;"
"void A(int a, pInt b, size_t c);",
@@ -381,7 +379,7 @@
}
TEST(DeclPrinter, TestFunctionDecl12) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void A(int a, int b = 0);",
"A",
"void A(int a, int b = 0)"));
@@ -389,7 +387,7 @@
}
TEST(DeclPrinter, TestFunctionDecl13) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void (*A(int a))(int b);",
"A",
"void (*A(int a))(int)"));
@@ -397,7 +395,7 @@
}
TEST(DeclPrinter, TestFunctionDecl14) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T>"
"void A(T t) { }"
"template<>"
@@ -409,7 +407,7 @@
TEST(DeclPrinter, TestCXXConstructorDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" A();"
"};",
@@ -419,7 +417,7 @@
}
TEST(DeclPrinter, TestCXXConstructorDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" A(int a);"
"};",
@@ -429,7 +427,7 @@
}
TEST(DeclPrinter, TestCXXConstructorDecl3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" A(const A &a);"
"};",
@@ -439,7 +437,7 @@
}
TEST(DeclPrinter, TestCXXConstructorDecl4) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" A(const A &a, int = 0);"
"};",
@@ -459,7 +457,7 @@
}
TEST(DeclPrinter, TestCXXConstructorDecl6) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" explicit A(int a);"
"};",
@@ -469,33 +467,30 @@
}
TEST(DeclPrinter, TestCXXConstructorDecl7) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX11Matches(
"struct A {"
" constexpr A();"
"};",
- ArrayRef<const char *>("-std=c++11"),
constructorDecl(ofClass(hasName("A"))).bind("id"),
""));
// WRONG; Should be: "constexpr A();"
}
TEST(DeclPrinter, TestCXXConstructorDecl8) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX11Matches(
"struct A {"
" A() = default;"
"};",
- ArrayRef<const char *>("-std=c++11"),
constructorDecl(ofClass(hasName("A"))).bind("id"),
""));
// WRONG; Should be: "A() = default;"
}
TEST(DeclPrinter, TestCXXConstructorDecl9) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX11Matches(
"struct A {"
" A() = delete;"
"};",
- ArrayRef<const char *>("-std=c++11"),
constructorDecl(ofClass(hasName("A"))).bind("id"),
" = delete"));
// WRONG; Should be: "A() = delete;"
@@ -526,7 +521,7 @@
#endif
TEST(DeclPrinter, TestCXXDestructorDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" ~A();"
"};",
@@ -536,7 +531,7 @@
}
TEST(DeclPrinter, TestCXXDestructorDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" virtual ~A();"
"};",
@@ -546,7 +541,7 @@
}
TEST(DeclPrinter, TestCXXConversionDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" operator int();"
"};",
@@ -556,7 +551,7 @@
}
TEST(DeclPrinter, TestCXXConversionDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct A {"
" operator bool();"
"};",
@@ -566,7 +561,7 @@
}
TEST(DeclPrinter, TestCXXConversionDecl3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {};"
"struct A {"
" operator Z();"
@@ -577,42 +572,39 @@
}
TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX11Matches(
"namespace std { typedef decltype(sizeof(int)) size_t; }"
"struct Z {"
" void *operator new(std::size_t);"
"};",
- ArrayRef<const char *>("-std=c++11"),
methodDecl(ofClass(hasName("Z"))).bind("id"),
"void *operator new(std::size_t)"));
// Should be: with semicolon
}
TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX11Matches(
"namespace std { typedef decltype(sizeof(int)) size_t; }"
"struct Z {"
" void *operator new[](std::size_t);"
"};",
- ArrayRef<const char *>("-std=c++11"),
methodDecl(ofClass(hasName("Z"))).bind("id"),
"void *operator new[](std::size_t)"));
// Should be: with semicolon
}
TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX11Matches(
"struct Z {"
" void operator delete(void *);"
"};",
- ArrayRef<const char *>("-std=c++11"),
methodDecl(ofClass(hasName("Z"))).bind("id"),
"void operator delete(void *) noexcept"));
// Should be: with semicolon, without noexcept?
}
TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction4) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" void operator delete(void *);"
"};",
@@ -622,11 +614,10 @@
}
TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction5) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX11Matches(
"struct Z {"
" void operator delete[](void *);"
"};",
- ArrayRef<const char *>("-std=c++11"),
methodDecl(ofClass(hasName("Z"))).bind("id"),
"void operator delete[](void *) noexcept"));
// Should be: with semicolon, without noexcept?
@@ -653,7 +644,7 @@
Expected.append("(Z z)");
// Should be: with semicolon
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
Code,
methodDecl(ofClass(hasName("Z"))).bind("id"),
Expected));
@@ -677,7 +668,7 @@
Expected.append("()");
// Should be: with semicolon
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
Code,
methodDecl(ofClass(hasName("Z"))).bind("id"),
Expected));
@@ -685,7 +676,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" void A(int a);"
"};",
@@ -695,7 +686,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" virtual void A(int a);"
"};",
@@ -705,7 +696,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" virtual void A(int a);"
"};"
@@ -719,7 +710,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl4) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" inline void A(int a);"
"};",
@@ -729,7 +720,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl5) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" virtual void A(int a) = 0;"
"};",
@@ -739,7 +730,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" void A(int a) const;"
"};",
@@ -749,7 +740,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" void A(int a) volatile;"
"};",
@@ -759,7 +750,7 @@
}
TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" void A(int a) const volatile;"
"};",
@@ -789,7 +780,7 @@
}
TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" void A(int a) throw();"
"};",
@@ -799,7 +790,7 @@
}
TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z {"
" void A(int a) throw(int);"
"};",
@@ -809,7 +800,7 @@
}
TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"class ZZ {};"
"struct Z {"
" void A(int a) throw(ZZ, int);"
@@ -861,7 +852,7 @@
}
TEST(DeclPrinter, TestVarDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"char *const (*(*A)[5])(int);",
"A",
"char *const (*(*A)[5])(int)"));
@@ -869,7 +860,7 @@
}
TEST(DeclPrinter, TestVarDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"void (*A)() throw(int);",
"A",
"void (*A)() throw(int)"));
@@ -885,7 +876,7 @@
}
TEST(DeclPrinter, TestFieldDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T>"
"struct Z { T A; };",
"A",
@@ -894,7 +885,7 @@
}
TEST(DeclPrinter, TestFieldDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<int N>"
"struct Z { int A[N]; };",
"A",
@@ -903,7 +894,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T>"
"struct A { T a; };",
classTemplateDecl(hasName("A")).bind("id"),
@@ -912,7 +903,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T = int>"
"struct A { T a; };",
classTemplateDecl(hasName("A")).bind("id"),
@@ -921,7 +912,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<class T>"
"struct A { T a; };",
classTemplateDecl(hasName("A")).bind("id"),
@@ -930,7 +921,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl4) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T, typename U>"
"struct A { T a; U b; };",
classTemplateDecl(hasName("A")).bind("id"),
@@ -939,7 +930,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl5) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<int N>"
"struct A { int a[N]; };",
classTemplateDecl(hasName("A")).bind("id"),
@@ -948,7 +939,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl6) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<int N = 42>"
"struct A { int a[N]; };",
classTemplateDecl(hasName("A")).bind("id"),
@@ -957,7 +948,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl7) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"typedef int MyInt;"
"template<MyInt N>"
"struct A { int a[N]; };",
@@ -967,7 +958,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl8) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<template<typename U> class T> struct A { };",
classTemplateDecl(hasName("A")).bind("id"),
"template <template <typename U> class T> struct A {\n}"));
@@ -975,7 +966,7 @@
}
TEST(DeclPrinter, TestClassTemplateDecl9) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T> struct Z { };"
"template<template<typename U> class T = Z> struct A { };",
classTemplateDecl(hasName("A")).bind("id"),
@@ -1002,7 +993,7 @@
}
TEST(DeclPrinter, TestClassTemplatePartialSpecializationDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T, typename U>"
"struct A { T a; U b; };"
"template<typename T>"
@@ -1013,7 +1004,7 @@
}
TEST(DeclPrinter, TestClassTemplatePartialSpecializationDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T>"
"struct A { T a; };"
"template<typename T>"
@@ -1024,7 +1015,7 @@
}
TEST(DeclPrinter, TestClassTemplateSpecializationDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T>"
"struct A { T a; };"
"template<>"
@@ -1035,7 +1026,7 @@
}
TEST(DeclPrinter, TestFunctionTemplateDecl1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T>"
"void A(T &t);",
functionTemplateDecl(hasName("A")).bind("id"),
@@ -1044,7 +1035,7 @@
}
TEST(DeclPrinter, TestFunctionTemplateDecl2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T>"
"void A(T &t) { }",
functionTemplateDecl(hasName("A")).bind("id"),
@@ -1064,7 +1055,7 @@
}
TEST(DeclPrinter, TestFunctionTemplateDecl4) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z { template<typename T> void A(T t); };",
functionTemplateDecl(hasName("A")).bind("id"),
"template <typename T> void A(T t)"));
@@ -1072,7 +1063,7 @@
}
TEST(DeclPrinter, TestFunctionTemplateDecl5) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"struct Z { template<typename T> void A(T t) {} };",
functionTemplateDecl(hasName("A")).bind("id"),
"template <typename T> void A(T t)"));
@@ -1080,7 +1071,7 @@
}
TEST(DeclPrinter, TestFunctionTemplateDecl6) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T >struct Z {"
" template<typename U> void A(U t) {}"
"};",
@@ -1090,7 +1081,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList1) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T> struct Z {};"
"struct X {};"
"Z<X> A;",
@@ -1100,7 +1091,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList2) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T, typename U> struct Z {};"
"struct X {};"
"typedef int Y;"
@@ -1111,7 +1102,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList3) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T> struct Z {};"
"template<typename T> struct X {};"
"Z<X<int> > A;",
@@ -1131,7 +1122,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList5) {
- ASSERT_TRUE(PrintedDeclCXX11Matches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T> struct Z {};"
"template<typename T> struct X { Z<T> A; };",
"A",
@@ -1140,7 +1131,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList6) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<template<typename T> class U> struct Z {};"
"template<typename T> struct X {};"
"Z<X> A;",
@@ -1150,7 +1141,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList7) {
- ASSERT_TRUE(PrintedDeclCXX11Matches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<template<typename T> class U> struct Z {};"
"template<template<typename T> class U> struct Y {"
" Z<U> A;"
@@ -1161,7 +1152,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList8) {
- ASSERT_TRUE(PrintedDeclCXX11Matches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<typename T> struct Z {};"
"template<template<typename T> class U> struct Y {"
" Z<U<int> > A;"
@@ -1172,7 +1163,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList9) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<unsigned I> struct Z {};"
"Z<0> A;",
"A",
@@ -1181,7 +1172,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList10) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<unsigned I> struct Z {};"
"template<unsigned I> struct X { Z<I> A; };",
"A",
@@ -1190,7 +1181,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList11) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<int I> struct Z {};"
"Z<42 * 10 - 420 / 1> A;",
"A",
@@ -1199,7 +1190,7 @@
}
TEST(DeclPrinter, TestTemplateArgumentList12) {
- ASSERT_TRUE(PrintedDeclMatches(
+ ASSERT_TRUE(PrintedDeclCXX98Matches(
"template<const char *p> struct Z {};"
"extern const char X[] = \"aaa\";"
"Z<X> A;",
@@ -1241,3 +1232,4 @@
"Z<sizeof...(T)> A"));
// Should be: with semicolon, without extra space in "> >"
}
+
More information about the cfe-commits
mailing list