[PATCH] D101052: [OpenCL] Allow pipe as a valid identifier prior to OpenCL 2.0

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 4 06:31:31 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG64911eec75bb: [OpenCL] Allow pipe as a valid identifier prior to OpenCL 2.0. (authored by Anastasia).
Herald added a subscriber: ldrumm.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101052

Files:
  clang/lib/Parse/ParseDecl.cpp
  clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl


Index: clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
===================================================================
--- clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
+++ clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
@@ -1,3 +1,9 @@
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
 
-void foo(read_only pipe int p); // expected-error {{expected parameter declarator}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+void foo(read_only pipe int p);
+// expected-warning at -1 {{type specifier missing, defaults to 'int'}}
+// expected-error at -2 {{access qualifier can only be used for pipe and image type}}
+// expected-error at -3 {{expected ')'}} expected-note at -3 {{to match this '('}}
+
+// 'pipe' should be accepted as an identifier.
+typedef int pipe;
Index: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -3930,6 +3930,7 @@
         // OpenCL 2.0 and later define this keyword. OpenCL 1.2 and earlier
         // should support the "pipe" word as identifier.
         Tok.getIdentifierInfo()->revertTokenIDToIdentifier();
+        Tok.setKind(tok::identifier);
         goto DoneWithDeclSpec;
       }
       isInvalid = DS.SetTypePipe(true, Loc, PrevSpec, DiagID, Policy);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101052.342714.patch
Type: text/x-patch
Size: 1337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210504/18b172b7/attachment-0001.bin>


More information about the cfe-commits mailing list