Bug 1483761 - Enable clang's -Wshadow-field-in-constructor warnings. r=glandium

This opt-in warning catches bugs where a constructor modifies a constructor parameter that shadows member variable name. The code probably intended to change the member variable value, not the paramter. There are currently no -Wshadow-field-in-constructor warnings in mozilla-central.

https://clang.llvm.org/docs/DiagnosticsReference.html#wshadow-field-in-constructor-modified

Differential Revision: https://phabricator.services.mozilla.com/D3822

--HG--
extra : rebase_source : 604ff90e036d536955db41351ee9ee97e8424d92
extra : intermediate-source : 712f538afc160f4efae2383130727edbd1dd70f6
extra : source : 300fff9a58515c7cac0647afc9ccc0e69bc8c5cb
This commit is contained in:
Chris Peterson 2018-08-20 10:10:57 -07:00
parent 874e8bf033
commit 8cddf640b9

View File

@ -31,6 +31,9 @@ add_gcc_warning('-Woverloaded-virtual', cxx_compiler)
# catches pointer arithmetic using NULL or sizeof(void)
add_gcc_warning('-Wpointer-arith')
# catch modifying constructor parameter that shadows member variable
check_and_add_gcc_warning('-Wshadow-field-in-constructor-modified')
# catches comparing signed/unsigned ints
add_gcc_warning('-Wsign-compare')