[PATCH] D126620: [clang] AST/Print: honor AlwaysIncludeTypeForTemplateArgument policy
Vassil Vassilev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 30 22:07:18 PDT 2022
v.g.vassilev added a comment.
This patch fixes our test case which we intended to fix with:
From 17e94a6a2adc3eb8d5fcc532eb1f3e57cc59b0fd Mon Sep 17 00:00:00 2001
From: Vassil Vassilev <v.g.vassilev at gmail.com>
Date: Mon, 23 May 2022 21:36:43 +0000
Subject: [PATCH] Fix type printing to not include the suffix when not needed.
before:
root.exe -l -b -q -e 'TClass::GetClass("std::array<int,3>")->Print()'
OBJ: TClassarray<int,3UL>
after: root.exe -l -b -q -e 'TClass::GetClass("std::array<int,3>")->Print()'
OBJ: TClassarray<int,3>
To be upstreamed.
---
interpreter/llvm/src/tools/clang/lib/AST/TypePrinter.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/interpreter/llvm/src/tools/clang/lib/AST/TypePrinter.cpp b/interpreter/llvm/src/tools/clang/lib/AST/TypePrinter.cpp
index 5de22f76f458..844a5be12836 100644
--- a/interpreter/llvm/src/tools/clang/lib/AST/TypePrinter.cpp
+++ b/interpreter/llvm/src/tools/clang/lib/AST/TypePrinter.cpp
@@ -1452,7 +1452,8 @@ void TypePrinter::printTemplateId(const TemplateSpecializationType *T,
T->getTemplateName().print(OS, Policy);
}
- printTemplateArgumentList(OS, T->template_arguments(), Policy);
+ printTemplateArgumentList(OS, T->template_arguments(), Policy,
+ TD->getTemplateParameters());
spaceBeforePlaceHolder(OS);
}
The proposed patch is better because it is more precise whereas my approach above has multiple test failures and may be impossible to upstream.
This LGTM, but I'd like to see what @rsmith thinks.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126620/new/
https://reviews.llvm.org/D126620
More information about the cfe-commits
mailing list