This revision was automatically updated to reflect the committed changes. Closed by commit rGc33ebad73516: Print default template argument if manually specified in typedef declaration. (authored by reikdas, committed by v.g.vassilev).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103040/new/ https://reviews.llvm.org/D103040 Files: clang/lib/AST/TypePrinter.cpp clang/test/SemaTemplate/class-template-id.cpp clang/test/SemaTemplate/default-arguments-ast-print.cpp Index: clang/test/SemaTemplate/default-arguments-ast-print.cpp =================================================================== --- clang/test/SemaTemplate/default-arguments-ast-print.cpp +++ clang/test/SemaTemplate/default-arguments-ast-print.cpp @@ -10,3 +10,15 @@ // CHECK: int Foo<int_type, double>::method1() return 10; } + +int test_typedef() { + typedef Foo<int, double> TypedefArg; + // CHECK: typedef Foo<int, double> TypedefArg; + return 10; +} + +int test_typedef2() { + typedef Foo<int> TypedefArg; + // CHECK: typedef Foo<int> TypedefArg; + return 10; +} Index: clang/test/SemaTemplate/class-template-id.cpp =================================================================== --- clang/test/SemaTemplate/class-template-id.cpp +++ clang/test/SemaTemplate/class-template-id.cpp @@ -9,9 +9,9 @@ if (ptr) return ptr; // okay else if (ptr2) - return ptr2; // expected-error{{cannot initialize return object of type 'A<int> *' with an lvalue of type 'const A<int> *'}} + return ptr2; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' (aka 'A<int, float> *') with an lvalue of type 'const A<int> *'}} else { - return ptr3; // expected-error{{cannot initialize return object of type 'A<int> *' with an lvalue of type 'A<int, double> *'}} + return ptr3; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' (aka 'A<int, float> *') with an lvalue of type 'A<int, double> *'}} } } Index: clang/lib/AST/TypePrinter.cpp =================================================================== --- clang/lib/AST/TypePrinter.cpp +++ clang/lib/AST/TypePrinter.cpp @@ -1449,8 +1449,7 @@ T->getTemplateName().print(OS, Policy); } - const TemplateParameterList *TPL = TD ? TD->getTemplateParameters() : nullptr; - printTemplateArgumentList(OS, T->template_arguments(), Policy, TPL); + printTemplateArgumentList(OS, T->template_arguments(), Policy); spaceBeforePlaceHolder(OS); }
Index: clang/test/SemaTemplate/default-arguments-ast-print.cpp =================================================================== --- clang/test/SemaTemplate/default-arguments-ast-print.cpp +++ clang/test/SemaTemplate/default-arguments-ast-print.cpp @@ -10,3 +10,15 @@ // CHECK: int Foo<int_type, double>::method1() return 10; } + +int test_typedef() { + typedef Foo<int, double> TypedefArg; + // CHECK: typedef Foo<int, double> TypedefArg; + return 10; +} + +int test_typedef2() { + typedef Foo<int> TypedefArg; + // CHECK: typedef Foo<int> TypedefArg; + return 10; +} Index: clang/test/SemaTemplate/class-template-id.cpp =================================================================== --- clang/test/SemaTemplate/class-template-id.cpp +++ clang/test/SemaTemplate/class-template-id.cpp @@ -9,9 +9,9 @@ if (ptr) return ptr; // okay else if (ptr2) - return ptr2; // expected-error{{cannot initialize return object of type 'A<int> *' with an lvalue of type 'const A<int> *'}} + return ptr2; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' (aka 'A<int, float> *') with an lvalue of type 'const A<int> *'}} else { - return ptr3; // expected-error{{cannot initialize return object of type 'A<int> *' with an lvalue of type 'A<int, double> *'}} + return ptr3; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' (aka 'A<int, float> *') with an lvalue of type 'A<int, double> *'}} } } Index: clang/lib/AST/TypePrinter.cpp =================================================================== --- clang/lib/AST/TypePrinter.cpp +++ clang/lib/AST/TypePrinter.cpp @@ -1449,8 +1449,7 @@ T->getTemplateName().print(OS, Policy); } - const TemplateParameterList *TPL = TD ? TD->getTemplateParameters() : nullptr; - printTemplateArgumentList(OS, T->template_arguments(), Policy, TPL); + printTemplateArgumentList(OS, T->template_arguments(), Policy); spaceBeforePlaceHolder(OS); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits