Skip to content

Commit

Permalink
[pseudo] Fix noptr-abstract-declarator rule.
Browse files Browse the repository at this point in the history
The const-expression in the [] can be empty.

Differential Revision: https://reviews.llvm.org/D126992
  • Loading branch information
hokein committed Jun 7, 2022
1 parent 7fa97b4 commit 58b33bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang-tools-extra/pseudo/lib/cxx.bnf
Expand Up @@ -429,7 +429,7 @@ abstract-declarator := abstract-pack-declarator
ptr-abstract-declarator := noptr-abstract-declarator
ptr-abstract-declarator := ptr-operator ptr-abstract-declarator_opt
noptr-abstract-declarator := noptr-abstract-declarator_opt parameters-and-qualifiers
noptr-abstract-declarator := noptr-abstract-declarator_opt [ constant-expression ]
noptr-abstract-declarator := noptr-abstract-declarator_opt [ constant-expression_opt ]
noptr-abstract-declarator := ( ptr-abstract-declarator )
abstract-pack-declarator := noptr-abstract-pack-declarator
abstract-pack-declarator := ptr-operator abstract-pack-declarator
Expand Down
7 changes: 7 additions & 0 deletions clang-tools-extra/pseudo/test/cxx/unsized-array.cpp
@@ -0,0 +1,7 @@
// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s
void s(int[]);
// CHECK: parameter-declaration-list~parameter-declaration := decl-specifier-seq abstract-declarator
// CHECK-NEXT: ├─decl-specifier-seq~INT := tok[3]
// CHECK-NEXT: └─abstract-declarator~noptr-abstract-declarator := [ ]
// CHECK-NEXT: ├─[ := tok[4]
// CHECK-NEXT: └─] := tok[5]

0 comments on commit 58b33bc

Please sign in to comment.