sammccall created this revision. sammccall added a reviewer: hokein. Herald added a project: All. sammccall requested review of this revision. Herald added subscribers: cfe-commits, alextsao1999. Herald added a project: clang-tools-extra.
I expect to eliminate this ambiguity at the grammar level by use of guards, because it interferes with brace-based error recvoery. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D127400 Files: clang-tools-extra/pseudo/test/cxx/declarator-function.cpp clang-tools-extra/pseudo/test/cxx/declarator-var.cpp Index: clang-tools-extra/pseudo/test/cxx/declarator-var.cpp =================================================================== --- /dev/null +++ clang-tools-extra/pseudo/test/cxx/declarator-var.cpp @@ -0,0 +1,12 @@ +// The standard grammar allows an function-body to use any declarator, including +// a non-function declarator. This creates an ambiguity where a +// simple-declaration is misparsed as a function-definition. +// FIXME: eliminate this false parse. +// XFAIL: * + +// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | +// FileCheck %s +void (*s)(){}; +// CHECK-NOT: function-definition +// CHECK: init-declarator := declarator initializer +// CHECK-NOT: function-definition Index: clang-tools-extra/pseudo/test/cxx/declarator-function.cpp =================================================================== --- /dev/null +++ clang-tools-extra/pseudo/test/cxx/declarator-function.cpp @@ -0,0 +1,12 @@ +// The standard grammar allows an init-list with any declarator, including +// a function declarator. This creates an ambiguity where a function-definition +// is misparsed as a simple-declaration. +// FIXME: eliminate this false parse. +// XFAIL: * + +// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | +// FileCheck %s +void s(){}; +// CHECK-NOT: simple-declaration +// CHECK: function-definition := decl-specifier-seq declarator +// function-body CHECK-NOT: simple-declaration
Index: clang-tools-extra/pseudo/test/cxx/declarator-var.cpp =================================================================== --- /dev/null +++ clang-tools-extra/pseudo/test/cxx/declarator-var.cpp @@ -0,0 +1,12 @@ +// The standard grammar allows an function-body to use any declarator, including +// a non-function declarator. This creates an ambiguity where a +// simple-declaration is misparsed as a function-definition. +// FIXME: eliminate this false parse. +// XFAIL: * + +// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | +// FileCheck %s +void (*s)(){}; +// CHECK-NOT: function-definition +// CHECK: init-declarator := declarator initializer +// CHECK-NOT: function-definition Index: clang-tools-extra/pseudo/test/cxx/declarator-function.cpp =================================================================== --- /dev/null +++ clang-tools-extra/pseudo/test/cxx/declarator-function.cpp @@ -0,0 +1,12 @@ +// The standard grammar allows an init-list with any declarator, including +// a function declarator. This creates an ambiguity where a function-definition +// is misparsed as a simple-declaration. +// FIXME: eliminate this false parse. +// XFAIL: * + +// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | +// FileCheck %s +void s(){}; +// CHECK-NOT: simple-declaration +// CHECK: function-definition := decl-specifier-seq declarator +// function-body CHECK-NOT: simple-declaration
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits