Print default template arguments

Fixes (at least) roottest-cling-stl-default-VectorSort and
roottest-cling-templateMembers-runoperatorEqual.
This commit is contained in:
Jonas Hahnfeld 2022-05-23 11:57:41 +02:00 committed by jenkins
parent 3bbcfe34b1
commit d8451f6822
2 changed files with 6 additions and 1 deletions

View File

@ -114,6 +114,8 @@ static std::string printQualType(clang::ASTContext& Ctx, clang::QualType QT) {
const QualType QTNonRef = QT.getNonReferenceType();
PrintingPolicy Policy(Ctx.getPrintingPolicy());
// Print the Allocator in STL containers, for instance.
Policy.SuppressDefaultTemplateArgs = false;
// DefinitionShadower: do not prepend `__cling_N5xxx::` to qualified names
Policy.SuppressUnwrittenScope = true;
// Print 'a<b<c> >' rather than 'a<b<c>>'.

View File

@ -196,7 +196,9 @@ void AppendClassName(const CXXRecordDecl* classDecl, std::string& name)
assert(classDecl != 0 && "AppendClassName, 'classDecl' parameter is null");
const LangOptions langOpts;
const PrintingPolicy printingPolicy(langOpts);
PrintingPolicy printingPolicy(langOpts);
// Print the default template arguments when asking for a class name.
printingPolicy.SuppressDefaultTemplateArgs = false;
std::string tmp;
//Name for diagnostic will include template arguments if any.
llvm::raw_string_ostream stream(tmp);
@ -277,6 +279,7 @@ void AppendMemberFunctionSignature(const Decl* methodDecl, std::string& name)
const LangOptions langOpts;
PrintingPolicy printingPolicy(langOpts);
printingPolicy.TerseOutput = true;//Do not print the body of an inlined function.
printingPolicy.SuppressDefaultTemplateArgs = false;
printingPolicy.SuppressSpecifiers = false; //Show 'static', 'inline', etc.
methodDecl->print(out, printingPolicy, 0, false);