Skip to content

Commit

Permalink
[SYCL] Some refactoring of integration header and fix one test
Browse files Browse the repository at this point in the history
 Delete a dependence of sycl runtime
 Move include kernel_desc.hpp to higher than forward declarations.

Signed-off-by: Vladimir Lazarev <vladimir.lazarev@intel.com>
  • Loading branch information
vladimirlaz committed Jan 22, 2019
1 parent 0bab53d commit 0a83bce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,19 +807,20 @@ void SYCLIntegrationHeader::emitForwardClassDecls(

void SYCLIntegrationHeader::emit(raw_ostream &O) {
O << "// This is auto-generated SYCL integration header.\n";
O << "\n";

O << "#include <CL/sycl/detail/kernel_desc.hpp>\n";

O << "\n";
O << "// Forward declarations of templated kernel function types:\n";

llvm::SmallPtrSet<const void *, 4> Printed;

for (const KernelDesc &K : KernelDescs) {
emitForwardClassDecls(O, K.NameType, Printed);
}
O << "\n";

O << "#include <CL/sycl/detail/kernel_desc.hpp>\n";

O << "\n";

O << "namespace cl {\n";
O << "namespace sycl {\n";
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGenSYCL/integration_header.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// RUN: %clang --sycl -Xclang -fsycl-int-header=%t.h %s -c -o %T/kernel.spv
// RUN: FileCheck -input-file=%t.h %s
//
// CHECK: #include <CL/sycl/detail/kernel_desc.hpp>
//
// CHECK: class first_kernel;
// CHECK-NEXT: namespace second_namespace {
// CHECK-NEXT: template <typename T> class second_kernel;
Expand All @@ -9,8 +11,6 @@
// CHECK-NEXT: template <typename T> struct point;
// CHECK-NEXT: template <int a, typename T1, typename T2> class third_kernel;
//
// CHECK: #include <CL/sycl/detail/kernel_desc.hpp>
//
// CHECK: static constexpr
// CHECK-NEXT: const char* const kernel_names[] = {
// CHECK-NEXT: "first_kernel",
Expand Down

0 comments on commit 0a83bce

Please sign in to comment.