]> granicus.if.org Git - clang/commit
[Sema] Warn about unused variables if we can constant evaluate the initializer.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 14 Oct 2017 01:30:49 +0000 (01:30 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 14 Oct 2017 01:30:49 +0000 (01:30 +0000)
commitad2da73ac3c4e576179e3aaf1be9f04ecea572c7
tree7af4c9f0a111ca1db68eb1659eb173af6aef0cb7
parent94cbcd43babae9b83e826f25ee8aa21069c53d94
[Sema] Warn about unused variables if we can constant evaluate the initializer.

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.

Differential Revision: https://reviews.llvm.org/D38678

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315787 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDecl.cpp
test/SemaCXX/warn-unused-variables.cpp