@@ -1386,6 +1386,75 @@ TEST(DeclPrinter, TestTemplateArgumentList16) {
1386
1386
ASSERT_TRUE (PrintedDeclCXX11Matches (Code, " NT2" , " int NT2 = 5" ));
1387
1387
}
1388
1388
1389
+ TEST (DeclPrinter, TestCXXRecordDecl17) {
1390
+ ASSERT_TRUE (PrintedDeclCXX98Matches (" template<typename T> struct Z {};"
1391
+ " struct X {};"
1392
+ " Z<X> A;" ,
1393
+ " A" , " Z<X> A" ));
1394
+ [](PrintingPolicy &Policy) { Policy.SuppressTagKeyword = false ; };
1395
+ }
1396
+
1397
+ TEST (DeclPrinter, TestCXXRecordDecl18) {
1398
+ ASSERT_TRUE (PrintedDeclCXX98Matches (" template<typename T> struct Z {};"
1399
+ " struct X {};"
1400
+ " Z<X> A;"
1401
+ " template <typename T1, int>"
1402
+ " struct Y{};"
1403
+ " Y<Z<X>, 2> B;" ,
1404
+ " B" , " Y<Z<X>, 2> B" ));
1405
+ [](PrintingPolicy &Policy) { Policy.SuppressTagKeyword = false ; };
1406
+ }
1407
+
1408
+ TEST (DeclPrinter, TestCXXRecordDecl19) {
1409
+ ASSERT_TRUE (PrintedDeclCXX98Matches (" template<typename T> struct Z {};"
1410
+ " struct X {};"
1411
+ " Z<X> A;"
1412
+ " template <typename T1, int>"
1413
+ " struct Y{};"
1414
+ " Y<Z<X>, 2> B;" ,
1415
+ " B" , " Y<Z<X>, 2> B" ));
1416
+ [](PrintingPolicy &Policy) { Policy.SuppressTagKeyword = true ; };
1417
+ }
1418
+ TEST (DeclPrinter, TestCXXRecordDecl20) {
1419
+ ASSERT_TRUE (PrintedDeclCXX98Matches (
1420
+ " template <typename T, int N> class Inner;"
1421
+ " template <typename T, int N>"
1422
+ " class Inner{Inner(T val){}};"
1423
+ " template <class InnerClass, int N> class Outer {"
1424
+ " public:"
1425
+ " struct NestedStruct {"
1426
+ " int nestedValue;"
1427
+ " NestedStruct(int val) : nestedValue(val) {}"
1428
+ " };"
1429
+ " InnerClass innerInstance;"
1430
+ " Outer(const InnerClass &inner) : innerInstance(inner) {}"
1431
+ " };"
1432
+ " Outer<Inner<int, 10>, 5>::NestedStruct nestedInstance(100);" ,
1433
+ " nestedInstance" ,
1434
+ " Outer<Inner<int, 10>, 5>::NestedStruct nestedInstance(100)" ));
1435
+ [](PrintingPolicy &Policy) { Policy.SuppressTagKeyword = false ; };
1436
+ }
1437
+
1438
+ TEST (DeclPrinter, TestCXXRecordDecl21) {
1439
+ ASSERT_TRUE (PrintedDeclCXX98Matches (
1440
+ " template <typename T, int N> class Inner;"
1441
+ " template <typename T, int N>"
1442
+ " class Inner{Inner(T val){}};"
1443
+ " template <class InnerClass, int N> class Outer {"
1444
+ " public:"
1445
+ " struct NestedStruct {"
1446
+ " int nestedValue;"
1447
+ " NestedStruct(int val) : nestedValue(val) {}"
1448
+ " };"
1449
+ " InnerClass innerInstance;"
1450
+ " Outer(const InnerClass &inner) : innerInstance(inner) {}"
1451
+ " };"
1452
+ " Outer<Inner<int, 10>, 5>::NestedStruct nestedInstance(100);" ,
1453
+ " nestedInstance" ,
1454
+ " Outer<Inner<int, 10>, 5>::NestedStruct nestedInstance(100)" ));
1455
+ [](PrintingPolicy &Policy) { Policy.SuppressTagKeyword = true ; };
1456
+ }
1457
+
1389
1458
TEST (DeclPrinter, TestFunctionParamUglified) {
1390
1459
llvm::StringLiteral Code = R"cpp(
1391
1460
class __c;
0 commit comments