diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index 9b2390cb07ca7..ef9f63b563930 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -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 \n"; + O << "\n"; O << "// Forward declarations of templated kernel function types:\n"; llvm::SmallPtrSet Printed; - for (const KernelDesc &K : KernelDescs) { emitForwardClassDecls(O, K.NameType, Printed); } O << "\n"; - O << "#include \n"; - O << "\n"; O << "namespace cl {\n"; O << "namespace sycl {\n"; diff --git a/clang/test/CodeGenSYCL/integration_header.cpp b/clang/test/CodeGenSYCL/integration_header.cpp index a2540339d819c..2409771366dd5 100644 --- a/clang/test/CodeGenSYCL/integration_header.cpp +++ b/clang/test/CodeGenSYCL/integration_header.cpp @@ -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 +// // CHECK: class first_kernel; // CHECK-NEXT: namespace second_namespace { // CHECK-NEXT: template class second_kernel; @@ -9,8 +11,6 @@ // CHECK-NEXT: template struct point; // CHECK-NEXT: template class third_kernel; // -// CHECK: #include -// // CHECK: static constexpr // CHECK-NEXT: const char* const kernel_names[] = { // CHECK-NEXT: "first_kernel",