This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Warn on unused results from ArrayRef and StringRef functions that read like they might mutate.
ClosedPublic

Authored by jlebar on Jul 19 2016, 3:12 PM.

Details

Summary

Functions like "slice" and "drop_front" sound like they might mutate the
underlying object, but they don't. Warning on unused results would have
saved me an hour yesterday, and I'm sure I'm not the only one.

LLVM and Clang are clean wrt this warning after D22540.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 64574.Jul 19 2016, 3:12 PM
jlebar retitled this revision from to [ADT] Warn on unused results from ArrayRef and StringRef functions that read like they might mutate..
jlebar updated this object.
jlebar added a reviewer: majnemer.
jlebar added subscribers: llvm-commits, chandlerc, sanjoy.
majnemer accepted this revision.Jul 19 2016, 3:31 PM
majnemer edited edge metadata.

LGTM!

This revision is now accepted and ready to land.Jul 19 2016, 3:31 PM
chandlerc accepted this revision.Jul 19 2016, 3:40 PM
chandlerc added a reviewer: chandlerc.

LGTM too, this is a great idea.

This revision was automatically updated to reflect the committed changes.