This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Warn about unused variables if we can constant evaluate the initializer.
ClosedPublic

Authored by bkramer on Oct 8 2017, 3:33 PM.

Details

Summary

If the variable construction can be constant evaluated it doesn't have
side effects, so removing it is always safe. We only try to evaluate
variables that are unused, there should be no impact on compile time.

Diff Detail

Repository
rL LLVM

Event Timeline

bkramer created this revision.Oct 8 2017, 3:33 PM
rsmith accepted this revision.Oct 13 2017, 5:36 PM

Cunning, I like it :)

This revision is now accepted and ready to land.Oct 13 2017, 5:36 PM
This revision was automatically updated to reflect the committed changes.

Excuse me, I have reverted it in rL315806. check-libcxx dislikes it.

See also; http://bb9.pgr.jp/#/builders/20/builds/111

For the record, this found 5 actual useless variables in Firefox code.