[PATCH] D69762: [Diagnostics] Try to improve warning message for -Wreturn-type

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 12:32:03 PST 2019


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:584-587
 def err_maybe_falloff_nonvoid_block : Error<
   "control may reach end of non-void block">;
 def err_falloff_nonvoid_block : Error<
   "control reaches end of non-void block">;
----------------
xbolva00 wrote:
> aaron.ballman wrote:
> > Should we change this wording as well? Along with any other instances of similar wording (I don't recall if we have something similar for lambdas or if we defer to the function diagnostics in that case)?
> +1, I agree.
> 
> It would be better if somebody more familiar with  Obj-C / coroutines and related terminology would improve these text.
I think you've already got the gist of it. `block does not return a value; non-void blocks must return a value`, and similar for coroutines.

In fact, I wonder why we don't just combine these diagnostics for all three situations and use a `%select` for them? That seems like a reasonable thing to do (having not put a ton of thought into it).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69762





More information about the cfe-commits mailing list