[PATCH] D62750: Show note for -Wmissing-prototypes for functions with parameters

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 12:09:58 PDT 2019


aaron.ballman added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:13335
+                        ? FixItHint::CreateInsertion(FTL.getRParenLoc(), "void")
+                        : FixItHint{});
         }
----------------
aaronpuchert wrote:
> aaron.ballman wrote:
> > In this case, we could probably generate the parameter declarations for the user still, couldn't we? e.g.,
> > ```
> > int f(); // We could insert "int i, int j" here as the fixit
> > int g(); // Just like we try to suggest "void" here already
> > 
> > int f(int i, int j) { return i + j; }
> > int g(void) { return 12; }
> > ```
> > That could be done in a follow-up patch though.
> One difficulty might be that certain types used in the parameter list of the definition aren't available where the declaration is, like
> 
> ```
> int f();
> 
> struct X { int n; };
> int f(struct X *x) { return x->n;}
> ```
> 
> So I'm not sure we can always do it, but sometimes perhaps.
That's a good point and reason enough to not try for it in this version of the patch (if at all).


Repository:
  rC Clang

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

https://reviews.llvm.org/D62750





More information about the cfe-commits mailing list