@@ -2146,23 +2146,14 @@ void make_narg_call(const FunctionDecl* FD, const std::string& return_type,
21462146 PP.SuppressElaboration = true ;
21472147 FD->getNameForDiagnostic (stream, PP,
21482148 /* Qualified=*/ false );
2149-
2150- // insert space between template argument list and the function name
2151- // this is require if the function is `operator<`
2152- // `operator<<type1, type2, ...>` is invalid syntax
2153- // whereas `operator< <type1, type2, ...>` is valid
2154- std::string simple_name = FD->getNameAsString ();
2155- size_t idx = complete_name.find (simple_name, 0 ) + simple_name.size ();
2156- std::string name_without_template_args = complete_name.substr (0 , idx);
2157- std::string template_args = complete_name.substr (idx);
2158- name = name_without_template_args +
2159- (template_args.empty () ? " " : " " + template_args);
2149+ name = complete_name;
21602150
21612151 // If a template has consecutive parameter packs, then it is impossible to
21622152 // use the explicit name in the wrapper, since the type deduction is what
21632153 // determines the split of the packs. Instead, we'll revert to the
21642154 // non-templated function name and hope that the type casts in the wrapper
21652155 // will suffice.
2156+ std::string simple_name = FD->getNameAsString ();
21662157 if (FD->isTemplateInstantiation () && FD->getPrimaryTemplate ()) {
21672158 const FunctionTemplateDecl* FTDecl =
21682159 llvm::dyn_cast<FunctionTemplateDecl>(FD->getPrimaryTemplate ());
@@ -2177,10 +2168,12 @@ void make_narg_call(const FunctionDecl* FD, const std::string& return_type,
21772168 numPacks = 0 ;
21782169 }
21792170 if (numPacks > 1 ) {
2180- name = name_without_template_args ;
2171+ name = simple_name ;
21812172 }
21822173 }
21832174 }
2175+ if (FD->isOverloadedOperator ())
2176+ name = simple_name;
21842177 }
21852178 if (op_flag || N <= 1 )
21862179 callbuf << name;
0 commit comments