snarang181 wrote:

> > > I feel like this is a solution that can grow out of hand very easily. IMO 
> > > the better solution would be to have `-Wmissing-noreturn` place a 
> > > `[[noreturn]]` into the AST to avoid incorrect follow-up diagnostics.
> 
> > 
> 
> > I agree, in principle I would expect Clang to be able to prove (in simple 
> > cases) that a function cannot return, and then treat it as-if they were 
> > marked as `[[noreturn]]` in the source code, not just for purposes of 
> > diagnostics but also optimization. Suppressing the `-Wreturn-type` warning 
> > does not achieve that.
> 
> 
> 
> Actually, I just saw this and think it is a reasonably good idea.  Rather 
> than trying to check the same functions over and over, we can 'cache' the 
> answers via an implicit function attribute (only when one of the relevant 
> diagnostics is enabled).  I'm not sure I would spell it `[[noreturn]]` even 
> when implicit (as that could result in cascading diagnostics, and I'm not 
> sure I want the optimization outcomes), but it would be generally more 
> accurate.
> 
> 
> 
> Sorry for not seeing this sooner.

No issues. I will work on it further, thanks. 

https://github.com/llvm/llvm-project/pull/145166
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to