erichkeane wrote:

> Moving the checks does work for these limited cases, but now that we don't 
> have them there, one of the old tests now doesn't show up the diagnosis:
> 
> ```c++
> void f() {
>   throw;
> }
> 
> void g() {
>   try {
>     f();
>   } catch (...) {
>   }
> }
> ```
> 
> Since there is a separate call:
> 
> ```c++
> return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.get(), Handlers);
> ```
> 
> and debugging under lldb, breakpoints don't reach (i.e exit early) the 
> transform calls.

Right, 'transform' only happens during template instantiation.  So we need to 
find 'some place' (that is a seperate function) to do these diagnostics.  I 
might suggest doing a new one, since there doesn't seem to be a sensible place 
to do so otherwise... perhaps something like:
```
void Sema::DiagnoseExceptionUse(bool isTry) {
// do the checking + diagnostic here, but have it check the decl-context for 
dependence
}
```

NOTE I had that return `void` instead of `bool`.  (And is `Diagnose` instead of 
`Check`).  I wonder if there is value to continuing (@AaronBallman??) and 
putting these in the AST anyway?  The continued checking is perhaps valuable, 
and tooling might appreciate it in the AST anyway.

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

Reply via email to