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

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 19:13:28 PDT 2019

aaronpuchert created this revision.
aaronpuchert added reviewers: bkramer, efriedma, rsmith.
Herald added subscribers: cfe-commits, jdoerfert.
Herald added a project: clang.

I've found that most often the proper way to fix this warning is to add
`static`, because if the code otherwise compiles and links, the function
or variable is apparently not needed outside of the TU.

There is no fix-it for the rare case of an "extern definition", because
that would require removing `extern` and I have no idea how to get the
source location of the storage class specifier from a VarDecl. I believe
this information is only available earlier in the AST construction from
DeclSpec::getStorageClassSpecLoc(), but we don't have that here.

  rC Clang



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59402.190770.patch
Type: text/x-patch
Size: 5124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190315/5a5c6aa7/attachment.bin>

More information about the cfe-commits mailing list