[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 05:33:42 PDT 2019


aaron.ballman accepted this revision.
aaron.ballman added a comment.

My only real concern about this is that sometimes the fix-it will be wrong because the issue is a typo in the definition. However, it seems like that could be handled by preferring typo correction when the edit distance is below a certain threshold or something along those lines, and could be done later.



================
Comment at: lib/Sema/SemaDecl.cpp:13216
+          << FD
+          << (!PossiblePrototype && (FD->getStorageClass() != SC_Extern)
+                  ? FixItHint::CreateInsertion(FD->getBeginLoc(), "static ")
----------------
You can drop the parens around the `!=` operator subexpressions.


================
Comment at: lib/Sema/SemaDecl.cpp:13220
+
+      if (PossiblePrototype && (FD->getNumParams() == 0)) {
         // We found a declaration that is not a prototype,
----------------
You can drop the parens here.


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