diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index 88812ecfc2bc0..ec2803b37159b 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -1826,20 +1826,10 @@ class SyclKernelDecompMarker : public SyclKernelFieldHandler { CollectionStack.back() = true; PointerStack.pop_back(); } else if (PointerStack.pop_back_val()) { - // FIXME: Stop triggering decomposition for non-trivial types with - // pointers - if (RD->isTrivial()) { - PointerStack.back() = true; - if (!RD->hasAttr()) - RD->addAttr( - SYCLGenerateNewTypeAttr::CreateImplicit(SemaRef.getASTContext())); - } else { - // We are visiting a non-trivial type with pointer. - CollectionStack.back() = true; - if (!RD->hasAttr()) - RD->addAttr(SYCLRequiresDecompositionAttr::CreateImplicit( - SemaRef.getASTContext())); - } + PointerStack.back() = true; + if (!RD->hasAttr()) + RD->addAttr( + SYCLGenerateNewTypeAttr::CreateImplicit(SemaRef.getASTContext())); } return true; } diff --git a/clang/test/CodeGenSYCL/inheritance.cpp b/clang/test/CodeGenSYCL/inheritance.cpp index aad68767a7ab6..ddf1b78596000 100644 --- a/clang/test/CodeGenSYCL/inheritance.cpp +++ b/clang/test/CodeGenSYCL/inheritance.cpp @@ -5,6 +5,7 @@ class second_base { public: int *e; + second_base(int *E) : e(E) {} }; class InnerFieldBase { @@ -23,7 +24,7 @@ struct base { struct derived : base, second_base { int a; - + derived() : second_base(nullptr) {} void operator()() const { } }; diff --git a/clang/test/SemaSYCL/decomposition.cpp b/clang/test/SemaSYCL/decomposition.cpp index 74d70ac662792..808f9bcb79a8b 100644 --- a/clang/test/SemaSYCL/decomposition.cpp +++ b/clang/test/SemaSYCL/decomposition.cpp @@ -212,6 +212,6 @@ int main() { myQueue.submit([&](sycl::handler &h) { h.single_task([=]() { return NonTrivialDerivedStructWithPtr.i;}); }); - // CHECK: FunctionDecl {{.*}}NonTrivialStructInBase{{.*}} 'void (__wrapper_class, int, int)' + // CHECK: FunctionDecl {{.*}}NonTrivialStructInBase{{.*}} 'void (__generated_NonTrivialDerived)' } } diff --git a/clang/test/SemaSYCL/inheritance.cpp b/clang/test/SemaSYCL/inheritance.cpp index 1a2bace2e6e57..8776fe94a46ea 100644 --- a/clang/test/SemaSYCL/inheritance.cpp +++ b/clang/test/SemaSYCL/inheritance.cpp @@ -11,6 +11,7 @@ class third_base { class second_base { public: int *e; + second_base(int *E) : e(E) {} }; class InnerFieldBase { @@ -29,7 +30,7 @@ struct base { struct derived : base, second_base, third_base{ int a; - + derived() : second_base(nullptr) {} void operator()() const { } };