[PATCH] D59402: Fix-it hints for -Wmissing-{prototypes,variable-declarations}

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 11:16:54 PDT 2019


aaron.ballman added a comment.

In D59402#1516421 <https://reviews.llvm.org/D59402#1516421>, @aaronpuchert wrote:

> I guess you're referring to "[fix-it hints] should only be used when it’s very likely they match the user’s intent".


Also, we're not attempting to recover from the error, which is a good point that @thakis raised. aka, if you apply the fix-it, you should also treat the declaration as though it were declared `static`.

> When turning on the warning on an existing code base, I think that `static` is almost always right. But when writing new code with the warning active, it might indeed not be the right thing. It could be that the declaration has been forgotten, or it has a typo. We wouldn't want users to apply `static` blindly, so a note explaining when it is appropriate does actually make a lot of sense. Perhaps I can also detect if this is in a header and not emit the note then. (Or emit a note suggesting `inline`.)
> 
> @aaron.ballman Would moving the fix-it to a note alleviate your concerns?

Yes, it would -- you also wouldn't have to attempt the recovery in this case.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59402/new/

https://reviews.llvm.org/D59402





More information about the cfe-commits mailing list