Remove ineffectual variable endpos

A (misspelled) comment said something about adjusting for trailing
spaces, but at that point the string had already been shortened several
times. I suspect this is just a left-over.

All tests pass with this removed, so let's revisit it with test coverage
if any bugs fall out.
This commit is contained in:
Kim Grasman 2019-09-29 14:54:09 +02:00
parent 7662c814a4
commit 919f21b5ff
1 changed files with 2 additions and 4 deletions

View File

@ -448,15 +448,13 @@ string MungedForwardDeclareLineForTemplates(const TemplateDecl* decl) {
raw_string_ostream ostream(line);
decl->print(ostream); // calls DeclPrinter
line = ostream.str();
string::size_type endpos = line.length();
// Get rid of the superclasses, if any (this will nix the body too).
line = Split(line, " :", 2)[0];
// Get rid of the template body, if any (true if no superclasses).
line = Split(line, " {", 2)[0];
// The template name is now the last word on the line. Replace it
// by its fully-qualified form. Apparently rfind's endpos
// argument is inclusive, so substract one to get past the end-space.
const string::size_type name = line.rfind(' ', endpos - 1);
// by its fully-qualified form.
const string::size_type name = line.rfind(' ');
CHECK_(name != string::npos && "Unexpected printable template-type");
return PrintForwardDeclare(decl, line.substr(0, name), GlobalFlags().cxx17ns);
}