ychen added a comment.

In D103938#2806885 <https://reviews.llvm.org/D103938#2806885>, @rsmith wrote:

> This will diagnose unused values in unreachable code in constant-evaluated 
> contexts; that doesn't seem quite right. For example, in:
>
>   void f() {
>     new double[false ? (1, 2) : 3][false ? (1, 2) : 3];
>   }
>
> ... we'll diagnose that the `1` is unused in only one of the two array 
> bounds, because one of them is a constant-evaluated context and the other is 
> not.
>
> I'd suggest we start by adding a separate `DiagIfReachable` function that 
> does the same thing as `DiagRuntimeBehavior` except without the context 
> check, with the intent to eventually refine it to check for reachability even 
> in expressions for which we don't build a CFG (eg, in the initializer of a 
> global or in a constant expression).

@rsmith Thanks for the pointer! Comments addressed. For the reachability check 
in contexts without CFG, it seems that some delayed processing is needed since 
constant evaluation happens later, however, I'm not sure about that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to