r268364 - [OpenCL] Fix pipe type dump.
Xiuli Pan via cfe-commits
cfe-commits at lists.llvm.org
Mon May 2 22:37:07 PDT 2016
Author: pxl
Date: Tue May 3 00:37:07 2016
New Revision: 268364
URL: http://llvm.org/viewvc/llvm-project?rev=268364&view=rev
Log:
[OpenCL] Fix pipe type dump.
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
Added:
cfe/trunk/test/Misc/ast-dump-pipe.cl
Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl
Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=268364&r1=268363&r2=268364&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Tue May 3 00:37:07 2016
@@ -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());
}
Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=268364&r1=268363&r2=268364&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Tue May 3 00:37:07 2016
@@ -895,7 +895,8 @@ void TypePrinter::printAtomicAfter(const
void TypePrinter::printPipeBefore(const PipeType *T, raw_ostream &OS) {
IncludeStrongLifetimeRAII Strong(Policy);
- OS << "pipe";
+ OS << "pipe ";
+ print(T->getElementType(), OS, StringRef());
spaceBeforePlaceHolder(OS);
}
Added: cfe/trunk/test/Misc/ast-dump-pipe.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-pipe.cl?rev=268364&view=auto
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-pipe.cl (added)
+++ cfe/trunk/test/Misc/ast-dump-pipe.cl Tue May 3 00:37:07 2016
@@ -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'
Modified: cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl?rev=268364&r1=268363&r2=268364&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl (original)
+++ cfe/trunk/test/SemaOpenCL/invalid-access-qualifier.cl Tue May 3 00:37:07 2016
@@ -8,7 +8,7 @@ void test2(read_only write_only image1d_
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
Modified: cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl?rev=268364&r1=268363&r2=268364&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl (original)
+++ cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl Tue May 3 00:37:07 2016
@@ -7,5 +7,5 @@ void test2(pipe p){// expected-error {{m
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}}
}
More information about the cfe-commits
mailing list