Skip to content

Commit

Permalink
[OpenCL] Fix pipe type dump.
Browse files Browse the repository at this point in the history
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

llvm-svn: 268364
  • Loading branch information
xiulipan committed May 3, 2016
1 parent 59e9748 commit 2d12e65
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions clang/lib/AST/ASTDumper.cpp
Expand Up @@ -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());
}
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/AST/TypePrinter.cpp
Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions clang/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'
2 changes: 1 addition & 1 deletion clang/test/SemaOpenCL/invalid-access-qualifier.cl
Expand Up @@ -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
2 changes: 1 addition & 1 deletion clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
Expand Up @@ -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}}
}

0 comments on commit 2d12e65

Please sign in to comment.