Re: [PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-05-02 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268364: [OpenCL] Fix pipe type dump. (authored by pxl).

Changed prior to commit:
  http://reviews.llvm.org/D19524?vs=55161=55946#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19524

Files:
  cfe/trunk/lib/AST/ASTDumper.cpp
  cfe/trunk/lib/AST/TypePrinter.cpp
  cfe/trunk/test/Misc/ast-dump-pipe.cl
  cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
  cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl

Index: cfe/trunk/lib/AST/ASTDumper.cpp
===
--- cfe/trunk/lib/AST/ASTDumper.cpp
+++ cfe/trunk/lib/AST/ASTDumper.cpp
@@ -404,6 +404,9 @@
 void VisitAtomicType(const AtomicType *T) {
   dumpTypeAsChild(T->getValueType());
 }
+void VisitPipeType(const PipeType *T) {
+  dumpTypeAsChild(T->getElementType());
+}
 void VisitAdjustedType(const AdjustedType *T) {
   dumpTypeAsChild(T->getOriginalType());
 }
Index: cfe/trunk/lib/AST/TypePrinter.cpp
===
--- cfe/trunk/lib/AST/TypePrinter.cpp
+++ cfe/trunk/lib/AST/TypePrinter.cpp
@@ -895,7 +895,8 @@
 void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream ) {
   IncludeStrongLifetimeRAII Strong(Policy);
 
-  OS << "pipe";
+  OS << "pipe ";
+  print(T->getElementType(), OS, StringRef());
   spaceBeforePlaceHolder(OS);
 }
 
Index: cfe/trunk/test/Misc/ast-dump-pipe.cl
===
--- cfe/trunk/test/Misc/ast-dump-pipe.cl
+++ cfe/trunk/test/Misc/ast-dump-pipe.cl
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple spir64 -cl-std=CL2.0 -ast-dump -ast-dump-filter 
pipetype %s | FileCheck -strict-whitespace %s
+typedef pipe int pipetype;
+// CHECK:  PipeType {{.*}} 'pipe int'
+// CHECK-NEXT:   BuiltinType {{.*}} 'int'
Index: cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
===
--- cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
+++ cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
@@ -8,7 +8,7 @@
 void test3(read_only read_only image1d_t i){} // expected-error{{multiple 
access qualifiers}}
 
 #ifdef CL20
-void test4(read_write pipe int i){} // expected-error{{access qualifier 
'read_write' can not be used for 'pipe'}}
+void test4(read_write pipe int i){} // expected-error{{access qualifier 
'read_write' can not be used for 'pipe int'}}
 #else
 void test4(__read_write image1d_t i) {} // expected-error{{access qualifier 
'__read_write' can not be used for '__read_write image1d_t' earlier than 
OpenCL2.0 version}}
 #endif
Index: cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl
===
--- cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl
+++ cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl
@@ -7,5 +7,5 @@
 void test3(int pipe p){// expected-error {{cannot combine with previous 'int' 
declaration specifier}}
 }
 void test4() {
-  pipe int p; // expected-error {{type 'pipe' can only be used as a function 
parameter}}
+  pipe int p; // expected-error {{type 'pipe int' can only be used as a 
function parameter}}
 }


Index: cfe/trunk/lib/AST/ASTDumper.cpp
===
--- cfe/trunk/lib/AST/ASTDumper.cpp
+++ cfe/trunk/lib/AST/ASTDumper.cpp
@@ -404,6 +404,9 @@
 void VisitAtomicType(const AtomicType *T) {
   dumpTypeAsChild(T->getValueType());
 }
+void VisitPipeType(const PipeType *T) {
+  dumpTypeAsChild(T->getElementType());
+}
 void VisitAdjustedType(const AdjustedType *T) {
   dumpTypeAsChild(T->getOriginalType());
 }
Index: cfe/trunk/lib/AST/TypePrinter.cpp
===
--- cfe/trunk/lib/AST/TypePrinter.cpp
+++ cfe/trunk/lib/AST/TypePrinter.cpp
@@ -895,7 +895,8 @@
 void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream ) {
   IncludeStrongLifetimeRAII Strong(Policy);
 
-  OS << "pipe";
+  OS << "pipe ";
+  print(T->getElementType(), OS, StringRef());
   spaceBeforePlaceHolder(OS);
 }
 
Index: cfe/trunk/test/Misc/ast-dump-pipe.cl
===
--- cfe/trunk/test/Misc/ast-dump-pipe.cl
+++ cfe/trunk/test/Misc/ast-dump-pipe.cl
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple spir64 -cl-std=CL2.0 -ast-dump -ast-dump-filter pipetype %s | FileCheck -strict-whitespace %s
+typedef pipe int pipetype;
+// CHECK:  PipeType {{.*}} 'pipe int'
+// CHECK-NEXT:   BuiltinType {{.*}} 'int'
Index: cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
===
--- cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
+++ cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
@@ -8,7 +8,7 @@
 void test3(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}}
 
 

Re: [PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-04-27 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks!


http://reviews.llvm.org/D19524



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-04-27 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

LGTM


http://reviews.llvm.org/D19524



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-04-26 Thread Xiuli PAN via cfe-commits
pxli168 updated this revision to Diff 55161.
pxli168 added a comment.

Add test and fix some old test.


http://reviews.llvm.org/D19524

Files:
  lib/AST/ASTDumper.cpp
  lib/AST/TypePrinter.cpp
  test/Misc/ast-dump-pipe.cl
  test/SemaOpenCL/invalid-access-qualifier.cl
  test/SemaOpenCL/invalid-pipes-cl2.0.cl

Index: test/SemaOpenCL/invalid-pipes-cl2.0.cl
===
--- test/SemaOpenCL/invalid-pipes-cl2.0.cl
+++ test/SemaOpenCL/invalid-pipes-cl2.0.cl
@@ -7,5 +7,5 @@
 void test3(int pipe p){// expected-error {{cannot combine with previous 'int' 
declaration specifier}}
 }
 void test4() {
-  pipe int p; // expected-error {{type 'pipe' can only be used as a function 
parameter}}
+  pipe int p; // expected-error {{type 'pipe int' can only be used as a 
function parameter}}
 }
Index: test/SemaOpenCL/invalid-access-qualifier.cl
===
--- test/SemaOpenCL/invalid-access-qualifier.cl
+++ test/SemaOpenCL/invalid-access-qualifier.cl
@@ -8,7 +8,7 @@
 void test3(read_only read_only image1d_t i){} // expected-error{{multiple 
access qualifiers}}
 
 #ifdef CL20
-void test4(read_write pipe int i){} // expected-error{{access qualifier 
'read_write' can not be used for 'pipe'}}
+void test4(read_write pipe int i){} // expected-error{{access qualifier 
'read_write' can not be used for 'pipe int'}}
 #else
 void test4(__read_write image1d_t i) {} // expected-error{{access qualifier 
'__read_write' can not be used for '__read_write image1d_t' earlier than 
OpenCL2.0 version}}
 #endif
Index: test/Misc/ast-dump-pipe.cl
===
--- /dev/null
+++ test/Misc/ast-dump-pipe.cl
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple spir64 -cl-std=CL2.0 -ast-dump -ast-dump-filter 
pipetype %s | FileCheck -strict-whitespace %s
+typedef pipe int pipetype;
+// CHECK:  PipeType {{.*}} 'pipe int'
+// CHECK-NEXT:   BuiltinType {{.*}} 'int'
Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -895,7 +895,8 @@
 void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream ) {
   IncludeStrongLifetimeRAII Strong(Policy);
 
-  OS << "pipe";
+  OS << "pipe ";
+  print(T->getElementType(), OS, StringRef());
   spaceBeforePlaceHolder(OS);
 }
 
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -404,6 +404,9 @@
 void VisitAtomicType(const AtomicType *T) {
   dumpTypeAsChild(T->getValueType());
 }
+void VisitPipeType(const PipeType *T) {
+  dumpTypeAsChild(T->getElementType());
+}
 void VisitAdjustedType(const AdjustedType *T) {
   dumpTypeAsChild(T->getOriginalType());
 }


Index: test/SemaOpenCL/invalid-pipes-cl2.0.cl
===
--- test/SemaOpenCL/invalid-pipes-cl2.0.cl
+++ test/SemaOpenCL/invalid-pipes-cl2.0.cl
@@ -7,5 +7,5 @@
 void test3(int pipe p){// expected-error {{cannot combine with previous 'int' declaration specifier}}
 }
 void test4() {
-  pipe int p; // expected-error {{type 'pipe' can only be used as a function parameter}}
+  pipe int p; // expected-error {{type 'pipe int' can only be used as a function parameter}}
 }
Index: test/SemaOpenCL/invalid-access-qualifier.cl
===
--- test/SemaOpenCL/invalid-access-qualifier.cl
+++ test/SemaOpenCL/invalid-access-qualifier.cl
@@ -8,7 +8,7 @@
 void test3(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}}
 
 #ifdef CL20
-void test4(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'pipe'}}
+void test4(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'pipe int'}}
 #else
 void test4(__read_write image1d_t i) {} // expected-error{{access qualifier '__read_write' can not be used for '__read_write image1d_t' earlier than OpenCL2.0 version}}
 #endif
Index: test/Misc/ast-dump-pipe.cl
===
--- /dev/null
+++ test/Misc/ast-dump-pipe.cl
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple spir64 -cl-std=CL2.0 -ast-dump -ast-dump-filter pipetype %s | FileCheck -strict-whitespace %s
+typedef pipe int pipetype;
+// CHECK:  PipeType {{.*}} 'pipe int'
+// CHECK-NEXT:   BuiltinType {{.*}} 'int'
Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -895,7 +895,8 @@
 void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream ) {
   IncludeStrongLifetimeRAII Strong(Policy);
 
-  OS << "pipe";
+  OS << "pipe ";
+  print(T->getElementType(), OS, StringRef());
   spaceBeforePlaceHolder(OS);
 }
 
Index: 

Re: [PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-04-26 Thread Xiuli PAN via cfe-commits
pxli168 added a comment.

I will add a test and send a new version.


http://reviews.llvm.org/D19524



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-04-26 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

Do you think we could add a test? For example similar to 
test/Misc/ast-dump-decl.c. We could have it for now in test/SemaOpenCL folder.


http://reviews.llvm.org/D19524



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-04-26 Thread Alexey Bader via cfe-commits
bader added a comment.

LGTM.
Probably it would be forth to add a simple test.


http://reviews.llvm.org/D19524



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D19524: [OpenCL] Fix pipe type dump.

2016-04-26 Thread Xiuli PAN via cfe-commits
pxli168 created this revision.
pxli168 added reviewers: Anastasia, yaxunl.
pxli168 added subscribers: bader, cfe-commits.

Fix the dump of PipeType.
Now we will have "pipe int" and element type.

http://reviews.llvm.org/D19524

Files:
  lib/AST/ASTDumper.cpp
  lib/AST/TypePrinter.cpp

Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -895,7 +895,8 @@
 void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream ) {
   IncludeStrongLifetimeRAII Strong(Policy);
 
-  OS << "pipe";
+  OS << "pipe ";
+  print(T->getElementType(), OS, StringRef());
   spaceBeforePlaceHolder(OS);
 }
 
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -404,6 +404,9 @@
 void VisitAtomicType(const AtomicType *T) {
   dumpTypeAsChild(T->getValueType());
 }
+void VisitPipeType(const PipeType *T) {
+  dumpTypeAsChild(T->getElementType());
+}
 void VisitAdjustedType(const AdjustedType *T) {
   dumpTypeAsChild(T->getOriginalType());
 }


Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -895,7 +895,8 @@
 void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream ) {
   IncludeStrongLifetimeRAII Strong(Policy);
 
-  OS << "pipe";
+  OS << "pipe ";
+  print(T->getElementType(), OS, StringRef());
   spaceBeforePlaceHolder(OS);
 }
 
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -404,6 +404,9 @@
 void VisitAtomicType(const AtomicType *T) {
   dumpTypeAsChild(T->getValueType());
 }
+void VisitPipeType(const PipeType *T) {
+  dumpTypeAsChild(T->getElementType());
+}
 void VisitAdjustedType(const AdjustedType *T) {
   dumpTypeAsChild(T->getOriginalType());
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits