@@ -729,7 +729,7 @@ getKernelInvocationKind(FunctionDecl *KernelCallerFunc) {
729
729
.Default (InvokeUnknown);
730
730
}
731
731
732
- static CXXRecordDecl *getKernelObjectType (FunctionDecl *Caller) {
732
+ static const CXXRecordDecl *getKernelObjectType (FunctionDecl *Caller) {
733
733
return (*Caller->param_begin ())->getType ()->getAsCXXRecordDecl ();
734
734
}
735
735
@@ -878,12 +878,12 @@ class KernelObjVisitor {
878
878
}
879
879
880
880
template <typename ParentTy, typename ... Handlers>
881
- void VisitRecord (CXXRecordDecl *Owner, ParentTy &Parent,
882
- CXXRecordDecl *Wrapper, Handlers &... handlers);
881
+ void VisitRecord (const CXXRecordDecl *Owner, ParentTy &Parent,
882
+ const CXXRecordDecl *Wrapper, Handlers &... handlers);
883
883
884
884
template <typename ... Handlers>
885
- void VisitRecordHelper (CXXRecordDecl *Owner,
886
- clang::CXXRecordDecl::base_class_range Range,
885
+ void VisitRecordHelper (const CXXRecordDecl *Owner,
886
+ clang::CXXRecordDecl::base_class_const_range Range,
887
887
Handlers &... handlers) {
888
888
for (const auto &Base : Range) {
889
889
(void )std::initializer_list<int >{
@@ -906,15 +906,15 @@ class KernelObjVisitor {
906
906
}
907
907
908
908
template <typename ... Handlers>
909
- void VisitRecordHelper (CXXRecordDecl *Owner,
910
- clang:: RecordDecl::field_range Range,
909
+ void VisitRecordHelper (const CXXRecordDecl *Owner,
910
+ RecordDecl::field_range Range,
911
911
Handlers &... handlers) {
912
912
VisitRecordFields (Owner, handlers...);
913
913
}
914
914
915
915
// FIXME: Can this be refactored/handled some other way?
916
916
template <typename ParentTy, typename ... Handlers>
917
- void VisitStreamRecord (CXXRecordDecl *Owner, ParentTy &Parent,
917
+ void VisitStreamRecord (const CXXRecordDecl *Owner, ParentTy &Parent,
918
918
CXXRecordDecl *Wrapper, Handlers &... handlers) {
919
919
(void )std::initializer_list<int >{
920
920
(handlers.enterStruct (Owner, Parent), 0 )...};
@@ -933,14 +933,15 @@ class KernelObjVisitor {
933
933
}
934
934
935
935
template <typename ... Handlers>
936
- void VisitRecordBases (CXXRecordDecl *KernelFunctor, Handlers &... handlers) {
936
+ void VisitRecordBases (const CXXRecordDecl *KernelFunctor,
937
+ Handlers &... handlers) {
937
938
VisitRecordHelper (KernelFunctor, KernelFunctor->bases (), handlers...);
938
939
}
939
940
940
941
// A visitor function that dispatches to functions as defined in
941
942
// SyclKernelFieldHandler for the purposes of kernel generation.
942
943
template <typename ... Handlers>
943
- void VisitRecordFields (CXXRecordDecl *Owner, Handlers &... handlers) {
944
+ void VisitRecordFields (const CXXRecordDecl *Owner, Handlers &... handlers) {
944
945
945
946
for (const auto Field : Owner->fields ()) {
946
947
(void )std::initializer_list<int >{
@@ -987,8 +988,8 @@ class KernelObjVisitor {
987
988
// type (which doesn't exist in cases where it is a FieldDecl in the
988
989
// 'root'), and Wrapper is the current struct being unwrapped.
989
990
template <typename ParentTy, typename ... Handlers>
990
- void KernelObjVisitor::VisitRecord (CXXRecordDecl *Owner, ParentTy &Parent,
991
- CXXRecordDecl *Wrapper,
991
+ void KernelObjVisitor::VisitRecord (const CXXRecordDecl *Owner, ParentTy &Parent,
992
+ const CXXRecordDecl *Wrapper,
992
993
Handlers &... handlers) {
993
994
(void )std::initializer_list<int >{(handlers.enterStruct (Owner, Parent), 0 )...};
994
995
VisitRecordHelper (Wrapper, Wrapper->bases (), handlers...);
@@ -1357,7 +1358,7 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
1357
1358
llvm::SmallVector<Expr *, 16 > InitExprs;
1358
1359
VarDecl *KernelObjClone;
1359
1360
InitializedEntity VarEntity;
1360
- CXXRecordDecl *KernelObj;
1361
+ const CXXRecordDecl *KernelObj;
1361
1362
llvm::SmallVector<Expr *, 16 > MemberExprBases;
1362
1363
uint64_t ArrayIndex;
1363
1364
FunctionDecl *KernelCallerFunc;
@@ -1524,7 +1525,7 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
1524
1525
// FIXME Avoid creation of kernel obj clone.
1525
1526
// See https://github.com/intel/llvm/issues/1544 for details.
1526
1527
static VarDecl *createKernelObjClone (ASTContext &Ctx, DeclContext *DC,
1527
- CXXRecordDecl *KernelObj) {
1528
+ const CXXRecordDecl *KernelObj) {
1528
1529
TypeSourceInfo *TSInfo =
1529
1530
KernelObj->isLambda () ? KernelObj->getLambdaTypeInfo () : nullptr ;
1530
1531
VarDecl *VD = VarDecl::Create (
@@ -1572,7 +1573,7 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
1572
1573
1573
1574
public:
1574
1575
SyclKernelBodyCreator (Sema &S, SyclKernelDeclCreator &DC,
1575
- CXXRecordDecl *KernelObj,
1576
+ const CXXRecordDecl *KernelObj,
1576
1577
FunctionDecl *KernelCallerFunc)
1577
1578
: SyclKernelFieldHandler(S), DeclCreator(DC),
1578
1579
KernelObjClone (createKernelObjClone(S.getASTContext(),
@@ -1934,7 +1935,7 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
1934
1935
void Sema::ConstructOpenCLKernel (FunctionDecl *KernelCallerFunc,
1935
1936
MangleContext &MC) {
1936
1937
// The first argument to the KernelCallerFunc is the lambda object.
1937
- CXXRecordDecl *KernelObj = getKernelObjectType (KernelCallerFunc);
1938
+ const CXXRecordDecl *KernelObj = getKernelObjectType (KernelCallerFunc);
1938
1939
assert (KernelObj && " invalid kernel caller" );
1939
1940
1940
1941
// Calculate both names, since Integration headers need both.
0 commit comments