[PATCH] D127400: [pseudo] Add xfail tests for a simple-declaration/function-definition ambiguity

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 06:52:44 PDT 2022


This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.
Closed by commit rG6b187fdf3bb4: [pseudo] Add xfail tests for a simple-declaration/function-definition ambiguity (authored by sammccall).

Changed prior to commit:
  https://reviews.llvm.org/D127400?vs=435510&id=439380#toc

Repository:
  rG LLVM Github Monorepo

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

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,11 @@
+// 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,11 @@
+// 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127400.439380.patch
Type: text/x-patch
Size: 1466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220623/5ee7d1ab/attachment.bin>


More information about the cfe-commits mailing list