summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Grasman <kim.grasman@gmail.com>2019-09-29 14:54:09 +0200
committerKim Grasman <kim.grasman@gmail.com>2019-09-29 14:54:09 +0200
commit919f21b5ffd85513503547b52084cc3f1eea732a (patch)
tree2fd1eec2109a8d8b2e8c854f54bc2d5f60080253
parent7662c814a4b4590057c03a84c3235f0a20a81b22 (diff)
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.
-rw-r--r--iwyu_output.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/iwyu_output.cc b/iwyu_output.cc
index a4c578e..ec936c5 100644
--- a/iwyu_output.cc
+++ b/iwyu_output.cc
@@ -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);
}