mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
Don't print &
as part of reference template arguments.
In passing, also generalize the mechanism used to allow Decl's printName functions to override qualified name printing.
This commit is contained in:
parent
b09ee88820
commit
9bd6b77ac6
@ -1542,10 +1542,19 @@ void NamedDecl::printQualifiedName(raw_ostream &OS,
|
||||
return;
|
||||
}
|
||||
printNestedNameSpecifier(OS, P);
|
||||
if (getDeclName() || isa<DecompositionDecl>(this))
|
||||
if (getDeclName())
|
||||
OS << *this;
|
||||
else
|
||||
OS << "(anonymous)";
|
||||
else {
|
||||
// Give the printName override a chance to pick a different name before we
|
||||
// fall back to "(anonymous)".
|
||||
SmallString<64> NameBuffer;
|
||||
llvm::raw_svector_ostream NameOS(NameBuffer);
|
||||
printName(NameOS);
|
||||
if (NameBuffer.empty())
|
||||
OS << "(anonymous)";
|
||||
else
|
||||
OS << NameBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
void NamedDecl::printNestedNameSpecifier(raw_ostream &OS) const {
|
||||
|
@ -352,13 +352,9 @@ void TemplateArgument::print(const PrintingPolicy &Policy,
|
||||
|
||||
case Declaration: {
|
||||
NamedDecl *ND = getAsDecl();
|
||||
Out << '&';
|
||||
if (ND->getDeclName()) {
|
||||
// FIXME: distinguish between pointer and reference args?
|
||||
ND->printQualifiedName(Out);
|
||||
} else {
|
||||
Out << "(anonymous)";
|
||||
}
|
||||
if (!getParamTypeForDecl()->isReferenceType())
|
||||
Out << '&';
|
||||
ND->printQualifiedName(Out);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -129,9 +129,7 @@ struct NN {
|
||||
// CHECK: [[NNV]] = distinct !DIGlobalVariable(name: "nn"
|
||||
// CHECK-SAME: type: ![[NNT:[0-9]+]]
|
||||
|
||||
// FIXME: these parameters should probably be rendered as 'glb' rather than
|
||||
// '&glb', since they're references, not pointers.
|
||||
// CHECK: ![[NNT]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "NN<tmpl_impl, &glb, &glb>",
|
||||
// CHECK: ![[NNT]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "NN<tmpl_impl, glb, glb>",
|
||||
// CHECK-SAME: templateParams: [[NNARGS:![0-9]*]]
|
||||
// CHECK-SAME: identifier:
|
||||
// CHECK: [[NNARGS]] = !{[[NNARG1:![0-9]*]], [[NNARG2:![0-9]*]], [[NNARG3:![0-9]*]]}
|
||||
|
Loading…
Reference in New Issue
Block a user