[omit-needless-words] Fix a bug found by -Wunused-result

StringRef::drop_back() returns the new string; it doesn't mutate `this`.
This commit is contained in:
Ben Langmuir
2016-09-14 13:52:59 -07:00
parent 6d32a0b1f8
commit 7562c10333
3 changed files with 6 additions and 1 deletions

View File

@@ -669,7 +669,7 @@ static StringRef omitNeedlessWords(StringRef name,
NameRole::Partial, allPropertyNames, scratch);
if (shortenedNameWord == newShortenedNameWord &&
shortenedNameWord.back() == 'e') {
shortenedNameWord.drop_back();
shortenedNameWord = shortenedNameWord.drop_back();
newShortenedNameWord =
omitNeedlessWords(shortenedNameWord, typeName.CollectionElement,
NameRole::Partial, allPropertyNames, scratch);