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@-1 {{type specifier missing, defaults to 'int'}} +// expected-error@-2 {{access qualifier can only be used for pipe and image type}} +// expected-error@-3 {{expected ')'}} expected-note@-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);
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@-1 {{type specifier missing, defaults to 'int'}} +// expected-error@-2 {{access qualifier can only be used for pipe and image type}} +// expected-error@-3 {{expected ')'}} expected-note@-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);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits