This is an archive of the discontinued LLVM Phabricator instance.

Do not check for parameters shadowing fields in function declarations
ClosedPublic

Authored by aaron.ballman on Dec 5 2018, 6:37 AM.

Details

Summary

This patch changes the way we handle -Wshadow-field so that we do not issue diagnostics for parameters in function declarations (as those are harmless), but we continue to diagnose parameters of function definitions.

Diff Detail

Event Timeline

aaron.ballman created this revision.Dec 5 2018, 6:37 AM
lebedev.ri added inline comments.
test/SemaCXX/warn-shadow.cpp
236

Can you please also add one function with out-of-line definition?

Added a test with an out-of-line definition.

aaron.ballman marked 2 inline comments as done.Dec 5 2018, 6:47 AM
aaron.ballman added inline comments.
test/SemaCXX/warn-shadow.cpp
236

Gladly!

steveire added inline comments.
test/SemaCXX/warn-shadow.cpp
236

Is this redundant now that you've added G?

aaron.ballman marked 2 inline comments as done.Dec 5 2018, 8:01 AM
aaron.ballman added inline comments.
test/SemaCXX/warn-shadow.cpp
236

Sort of. G eventually has a body whereas F does not -- one of the gates on this logic is a function named willHaveBody(), so a bit of redundancy here seems reasonable.

This revision is now accepted and ready to land.Dec 5 2018, 9:53 AM
aaron.ballman closed this revision.Dec 5 2018, 10:59 AM

Committed in r348400.