зеркало из https://github.com/microsoft/clang-1.git
Clean up the printing of template argument packs; previously, we were
getting extra "<>" delimiters around template argument packs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122280 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
8491ffe86c
Коммит
dace95b13e
|
@ -2796,7 +2796,8 @@ public:
|
|||
/// enclosing the template arguments.
|
||||
static std::string PrintTemplateArgumentList(const TemplateArgument *Args,
|
||||
unsigned NumArgs,
|
||||
const PrintingPolicy &Policy);
|
||||
const PrintingPolicy &Policy,
|
||||
bool SkipBrackets = false);
|
||||
|
||||
static std::string PrintTemplateArgumentList(const TemplateArgumentLoc *Args,
|
||||
unsigned NumArgs,
|
||||
|
|
|
@ -759,16 +759,23 @@ std::string
|
|||
TemplateSpecializationType::PrintTemplateArgumentList(
|
||||
const TemplateArgument *Args,
|
||||
unsigned NumArgs,
|
||||
const PrintingPolicy &Policy) {
|
||||
const PrintingPolicy &Policy,
|
||||
bool SkipBrackets) {
|
||||
std::string SpecString;
|
||||
SpecString += '<';
|
||||
if (!SkipBrackets)
|
||||
SpecString += '<';
|
||||
|
||||
for (unsigned Arg = 0; Arg < NumArgs; ++Arg) {
|
||||
if (Arg)
|
||||
if (SpecString.size() > !SkipBrackets)
|
||||
SpecString += ", ";
|
||||
|
||||
// Print the argument into a string.
|
||||
std::string ArgString;
|
||||
{
|
||||
if (Args[Arg].getKind() == TemplateArgument::Pack) {
|
||||
ArgString = PrintTemplateArgumentList(Args[Arg].pack_begin(),
|
||||
Args[Arg].pack_size(),
|
||||
Policy, true);
|
||||
} else {
|
||||
llvm::raw_string_ostream ArgOut(ArgString);
|
||||
Args[Arg].print(Policy, ArgOut);
|
||||
}
|
||||
|
@ -788,7 +795,8 @@ TemplateSpecializationType::PrintTemplateArgumentList(
|
|||
if (SpecString[SpecString.size() - 1] == '>')
|
||||
SpecString += ' ';
|
||||
|
||||
SpecString += '>';
|
||||
if (!SkipBrackets)
|
||||
SpecString += '>';
|
||||
|
||||
return SpecString;
|
||||
}
|
||||
|
@ -800,12 +808,17 @@ PrintTemplateArgumentList(const TemplateArgumentLoc *Args, unsigned NumArgs,
|
|||
std::string SpecString;
|
||||
SpecString += '<';
|
||||
for (unsigned Arg = 0; Arg < NumArgs; ++Arg) {
|
||||
if (Arg)
|
||||
if (SpecString.size() > 1)
|
||||
SpecString += ", ";
|
||||
|
||||
// Print the argument into a string.
|
||||
std::string ArgString;
|
||||
{
|
||||
if (Args[Arg].getArgument().getKind() == TemplateArgument::Pack) {
|
||||
ArgString = PrintTemplateArgumentList(
|
||||
Args[Arg].getArgument().pack_begin(),
|
||||
Args[Arg].getArgument().pack_size(),
|
||||
Policy, true);
|
||||
} else {
|
||||
llvm::raw_string_ostream ArgOut(ArgString);
|
||||
Args[Arg].getArgument().print(Policy, ArgOut);
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ struct tuple_of_refs {
|
|||
|
||||
Tuple<int&, float&> *t_int_ref_float_ref;
|
||||
tuple_of_refs<int&, float&>::types *t_int_ref_float_ref_2 = t_int_ref_float_ref;
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ ExpansionLengthMismatch<int, long>::Inner<unsigned int, unsigned long>::type
|
|||
*il_pairs;
|
||||
tuple<pair<int, unsigned int>, pair<long, unsigned long> >*il_pairs_2 = il_pairs;
|
||||
|
||||
ExpansionLengthMismatch<short, int, long>::Inner<unsigned int, unsigned long>::type // expected-note{{in instantiation of}}
|
||||
ExpansionLengthMismatch<short, int, long>::Inner<unsigned int, unsigned long>::type // expected-note{{in instantiation of template class 'ExpansionLengthMismatch<short, int, long>::Inner<unsigned int, unsigned long>' requested here}}
|
||||
*il_pairs_bad;
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче