aaron.ballman added a comment.

In D132952#3759109 <https://reviews.llvm.org/D132952#3759109>, @efriedma wrote:

>> We have the VariableArrayType to represent a VLA type and I think we're 
>> using that type when we should be using a variably modified type
>
> The clang AST for function signatures encodes two types: the type as written, 
> and the type after promotion.  Semantic analysis always uses the type after 
> promotion, but the type as written is useful if you're trying to do source 
> rewriting, or something like that.

Agreed; we need the type as written for `-ast-print` support, as well as AST 
matchers, etc.

> We could theoretically mess with the AST representation somehow, but I don't 
> see any compelling reason to.  We probably just want to emit the 
> warn_vla_used diagnostic somewhere else.

Yeah, re-reading the C standard, I think I got VM types slightly wrong. 
Consider:

  void func(int n, int array[n]);

`array` is a VLA (C2x 6.7.6.2p4) before pointer adjustment (C2x 6.7.6.3p6), 
which makes `func` a VM type (C2x 6.7.6p3), not `array`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132952

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

Reply via email to