steakhal added inline comments.

================
Comment at: clang/test/Analysis/initialization.c:101-102
+
+const int glob_arr3[];              // Incomplete array declaration
+const int glob_arr3[4] = {1, 2, 3}; // Incomplete Array redeclaration
+void foo() {
----------------
ASDenysPetrov wrote:
> martong wrote:
> > I'd like to see some more elaborate test cases. Notably
> > ```
> > const int glob_arr3[];              // Incomplete array declaration
> > const int glob_arr3[4] = {1, 2, 3}; // Incomplete Array redeclaration
> > const int glob_arr3[];              // Incomplete array redeclaration
> > ```
> > here neither the canonical nor the most recent decl have the initexpr.
> > And I think this is what @balazske tried to point out.
> Exactly. I'll add this particular case, but I should mention that **AST** 
> surprisingly shows the third redeclaration as `ConstantArrayType` with the 
> extent. Thus, it works for the current fix.
> ```
> |-VarDecl 0xc0725b0 <line:6:1, col:21> col:11 glob_arr3 'const int []'
> |-VarDecl 0xc072700 prev 0xc0725b0 <line:7:1, col:34> col:11 glob_arr3 'const 
> int [4]' cinit
> | `-InitListExpr 0xc072830 <col:26, col:34> 'const int [4]'
> |   |-array_filler: ImplicitValueInitExpr 0xc0728a8 <<invalid sloc>> 'const 
> int'
> |   |-IntegerLiteral 0xc072768 <col:27> 'int' 1
> |   |-IntegerLiteral 0xc072788 <col:30> 'int' 2
> |   `-IntegerLiteral 0xc0727a8 <col:33> 'int' 3
> `-VarDecl 0xc0728e0 prev 0xc072700 <line:8:1, col:21> col:11 glob_arr3 'const 
> int [4]'
> ```
So, the redeclaration actually changed the type to `ConstantArrayType`. If so, 
you should probably mention this in the comment.


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

https://reviews.llvm.org/D111542

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

Reply via email to