Skip to content

Commit 54abcd0

Browse files
committed
Revert back changes to default constructor
1 parent eb31ca0 commit 54abcd0

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,23 +3950,13 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
39503950
}
39513951

39523952
// Default inits the type, then calls the init-method in the body.
3953-
// A type may not have a public default constructor as per its spec so
3954-
// typically if this is the case the default constructor will be private and
3955-
// in such cases we must manually override the access specifier from private
3956-
// to public just for the duration of this default initialization.
39573953
bool handleSpecialType(FieldDecl *FD, QualType Ty) {
3958-
const auto *RecordDecl = Ty->getAsCXXRecordDecl();
3959-
AccessSpecifier DefaultConstructorAccess;
3960-
auto DefaultConstructor =
3961-
std::find_if(RecordDecl->ctor_begin(), RecordDecl->ctor_end(),
3962-
[](auto it) { return it->isDefaultConstructor(); });
3963-
DefaultConstructorAccess = DefaultConstructor->getAccess();
3964-
DefaultConstructor->setAccess(AS_public);
39653954
addFieldInit(FD, Ty, std::nullopt,
39663955
InitializationKind::CreateDefault(KernelCallerSrcLoc));
3967-
DefaultConstructor->setAccess(DefaultConstructorAccess);
3956+
39683957
addFieldMemberExpr(FD, Ty);
39693958

3959+
const auto *RecordDecl = Ty->getAsCXXRecordDecl();
39703960
createSpecialMethodCall(RecordDecl, getInitMethodName(), BodyStmts);
39713961
CXXMethodDecl *FinalizeMethod =
39723962
getMethodByName(RecordDecl, FinalizeMethodName);

sycl/include/sycl/ext/oneapi/experimental/work_group_memory.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(work_group_memory) work_group_memory
4949
using decoratedPtr = typename sycl::detail::DecoratedType<
5050
value_type, access::address_space::local_space>::type *;
5151

52+
public:
5253
// Frontend requires special types to have a default constructor in order to
5354
// have a uniform way of initializing an object of special type to then call
54-
// the __init method on it. This is purely an implementation detail and not
55-
// part of the spec.
55+
// the __init method on it. This is currently not part of the spec.
56+
// TODO: Remove this once https://github.com/intel/llvm/issues/16061 is
57+
// closed.
5658
work_group_memory() = default;
5759

58-
public:
59-
work_group_memory(const indeterminate_t &) {};
60+
work_group_memory(const indeterminate_t &){};
6061
work_group_memory(const work_group_memory &rhs) = default;
6162
work_group_memory &operator=(const work_group_memory &rhs) = default;
6263
template <typename T = DataT,

0 commit comments

Comments
 (0)