]> granicus.if.org Git - clang/commitdiff
[OpenCL] Fix pipe type dump.
authorXiuli Pan <xiulipan@outlook.com>
Tue, 3 May 2016 05:37:07 +0000 (05:37 +0000)
committerXiuli Pan <xiulipan@outlook.com>
Tue, 3 May 2016 05:37:07 +0000 (05:37 +0000)
Summary:
Fix the dump of PipeType.
Now we will have "pipe int" and element type.

Reviewers: yaxunl, Anastasia

Subscribers: cfe-commits, bader

Differential Revision: http://reviews.llvm.org/D19524

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268364 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTDumper.cpp
lib/AST/TypePrinter.cpp
test/Misc/ast-dump-pipe.cl [new file with mode: 0644]
test/SemaOpenCL/invalid-access-qualifier.cl
test/SemaOpenCL/invalid-pipes-cl2.0.cl

index 027889747e3ff1b45b9325e165e6c528c42e0d99..05d8da298cd2c13dd58025ad982bff7edb49e373 100644 (file)
@@ -404,6 +404,9 @@ namespace  {
     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 263a24f4ae6ddeb6c101550cf3e6f7da44139cc5..0356dc515f4f1e4b2491adf93449676397b0233c 100644 (file)
@@ -895,7 +895,8 @@ void TypePrinter::printAtomicAfter(const AtomicType *T, raw_ostream &OS) { }
 void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream &OS) {
   IncludeStrongLifetimeRAII Strong(Policy);
 
-  OS << "pipe";
+  OS << "pipe ";
+  print(T->getElementType(), OS, StringRef());
   spaceBeforePlaceHolder(OS);
 }
 
diff --git a/test/Misc/ast-dump-pipe.cl b/test/Misc/ast-dump-pipe.cl
new file mode 100644 (file)
index 0000000..1690e5c
--- /dev/null
@@ -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 5af3c4c959c80c9b2b80bd56718011cd96046f47..8dc7002e1b4d6d492ba7b9abf3c925642ff8d999 100644 (file)
@@ -8,7 +8,7 @@ void test2(read_only write_only image1d_t i){} // expected-error{{multiple acces
 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 0e44855fb0218606a03720bb1238974db7226db2..c8e582e6e879516ac29ac8ff28e7ad44bea86962 100644 (file)
@@ -7,5 +7,5 @@ void test2(pipe p){// expected-error {{missing actual type specifier for pipe}}
 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}}
 }