@@ -4708,9 +4708,8 @@ class FreeFunctionKernelBodyCreator : public SyclKernelFieldHandler {
47084708
47094709 bool leaveStruct (const CXXRecordDecl *, ParmVarDecl *, QualType) final {
47104710 ArgExprs.push_back (SemaSYCLRef.SemaRef .BuildDeclRefExpr (
4711- DeclCreator.getParentStruct (),
4712- DeclCreator.getParentStruct ()->getType (), VK_PRValue,
4713- FreeFunctionSrcLoc));
4711+ DeclCreator.getParentStruct (), DeclCreator.getParentStruct ()->getType (),
4712+ VK_PRValue, FreeFunctionSrcLoc));
47144713 return true ;
47154714 }
47164715
@@ -4803,8 +4802,8 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
48034802 void addParam (const ParmVarDecl *PD, QualType ParamTy,
48044803 SYCLIntegrationHeader::kernel_param_kind_t Kind) {
48054804 addParam (ParamTy, Kind, offsetOf (PD, ParamTy));
4806- // CurOffset +=
4807- // SemaSYCLRef.getASTContext().getTypeSizeInChars(ParamTy).getQuantity();
4805+ // CurOffset +=
4806+ // SemaSYCLRef.getASTContext().getTypeSizeInChars(ParamTy).getQuantity();
48084807 }
48094808
48104809 void addParam (QualType ParamTy,
@@ -4965,149 +4964,148 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
49654964 return true ;
49664965 }
49674966
4968- bool handlePointerType (FieldDecl * FD, QualType FieldTy) final {
4969- addParam (FD, FieldTy,
4970- ((StructDepth) ? SYCLIntegrationHeader::kind_std_layout
4971- : SYCLIntegrationHeader::kind_pointer));
4972- return true ;
4973- }
4967+ bool handlePointerType (FieldDecl *FD, QualType FieldTy) final {
4968+ addParam (FD, FieldTy,
4969+ ((StructDepth) ? SYCLIntegrationHeader::kind_std_layout
4970+ : SYCLIntegrationHeader::kind_pointer));
4971+ return true ;
4972+ }
49744973
4975- bool handlePointerType (ParmVarDecl * PD, QualType ParamTy) final {
4976- addParam (PD, ParamTy, SYCLIntegrationHeader::kind_pointer);
4977- return true ;
4978- }
4974+ bool handlePointerType (ParmVarDecl *PD, QualType ParamTy) final {
4975+ addParam (PD, ParamTy, SYCLIntegrationHeader::kind_pointer);
4976+ return true ;
4977+ }
49794978
4980- bool handleScalarType (FieldDecl * FD, QualType FieldTy) final {
4981- addParam (FD, FieldTy, SYCLIntegrationHeader::kind_std_layout);
4982- return true ;
4983- }
4979+ bool handleScalarType (FieldDecl *FD, QualType FieldTy) final {
4980+ addParam (FD, FieldTy, SYCLIntegrationHeader::kind_std_layout);
4981+ return true ;
4982+ }
49844983
4985- bool handleScalarType (ParmVarDecl * PD, QualType ParamTy) final {
4986- addParam (PD, ParamTy, SYCLIntegrationHeader::kind_std_layout);
4987- return true ;
4988- }
4984+ bool handleScalarType (ParmVarDecl *PD, QualType ParamTy) final {
4985+ addParam (PD, ParamTy, SYCLIntegrationHeader::kind_std_layout);
4986+ return true ;
4987+ }
49894988
4990- bool handleSimpleArrayType (FieldDecl * FD, QualType FieldTy) final {
4991- // Arrays are always wrapped inside of structs, so just treat it as a
4992- // simple struct.
4993- addParam (FD, FieldTy, SYCLIntegrationHeader::kind_std_layout);
4994- return true ;
4995- }
4989+ bool handleSimpleArrayType (FieldDecl *FD, QualType FieldTy) final {
4990+ // Arrays are always wrapped inside of structs, so just treat it as a
4991+ // simple struct.
4992+ addParam (FD, FieldTy, SYCLIntegrationHeader::kind_std_layout);
4993+ return true ;
4994+ }
49964995
4997- bool handleTopLevelStruct (const CXXRecordDecl *, QualType Ty) final {
4998- addParam (Ty, SYCLIntegrationHeader::kind_std_layout, /* Offset=*/ 0 );
4999- return true ;
5000- }
4996+ bool handleTopLevelStruct (const CXXRecordDecl *, QualType Ty) final {
4997+ addParam (Ty, SYCLIntegrationHeader::kind_std_layout, /* Offset=*/ 0 );
4998+ return true ;
4999+ }
50015000
5002- bool handleNonDecompStruct (const CXXRecordDecl *, FieldDecl *FD,
5003- QualType Ty) final {
5004- addParam (FD, Ty, SYCLIntegrationHeader::kind_std_layout);
5005- return true ;
5006- }
5001+ bool handleNonDecompStruct (const CXXRecordDecl *, FieldDecl *FD,
5002+ QualType Ty) final {
5003+ addParam (FD, Ty, SYCLIntegrationHeader::kind_std_layout);
5004+ return true ;
5005+ }
50075006
5008- bool handleNonDecompStruct (const CXXRecordDecl *, ParmVarDecl *PD,
5009- QualType ParamTy) final {
5010- addParam (PD, ParamTy, SYCLIntegrationHeader::kind_std_layout);
5011- return true ;
5012- }
5007+ bool handleNonDecompStruct (const CXXRecordDecl *, ParmVarDecl *PD,
5008+ QualType ParamTy) final {
5009+ addParam (PD, ParamTy, SYCLIntegrationHeader::kind_std_layout);
5010+ return true ;
5011+ }
50135012
5014- bool handleNonDecompStruct (const CXXRecordDecl *Base,
5015- const CXXBaseSpecifier &, QualType Ty) final {
5016- addParam (Ty, SYCLIntegrationHeader::kind_std_layout,
5017- offsetOf (Base, Ty->getAsCXXRecordDecl ()));
5018- return true ;
5019- }
5013+ bool handleNonDecompStruct (const CXXRecordDecl *Base,
5014+ const CXXBaseSpecifier &, QualType Ty) final {
5015+ addParam (Ty, SYCLIntegrationHeader::kind_std_layout,
5016+ offsetOf (Base, Ty->getAsCXXRecordDecl ()));
5017+ return true ;
5018+ }
50205019
5021- bool handleUnionType (FieldDecl * FD, QualType FieldTy) final {
5022- return handleScalarType (FD, FieldTy);
5023- }
5020+ bool handleUnionType (FieldDecl *FD, QualType FieldTy) final {
5021+ return handleScalarType (FD, FieldTy);
5022+ }
50245023
5025- bool handleUnionType (ParmVarDecl *, QualType) final {
5026- // TODO
5027- unsupportedFreeFunctionParamType ();
5028- return true ;
5029- }
5024+ bool handleUnionType (ParmVarDecl *, QualType) final {
5025+ // TODO
5026+ unsupportedFreeFunctionParamType ();
5027+ return true ;
5028+ }
50305029
5031- void handleSyclKernelHandlerType (QualType) {
5032- // The compiler generated kernel argument used to initialize SYCL 2020
5033- // specialization constants, `specialization_constants_buffer`, should
5034- // have corresponding entry in integration header.
5035- ASTContext &Context = SemaSYCLRef.getASTContext ();
5036- // Offset is zero since kernel_handler argument is not part of
5037- // kernel object (i.e. it is not captured)
5038- addParam (Context.getPointerType (Context.CharTy ),
5039- SYCLIntegrationHeader::kind_specialization_constants_buffer, 0 );
5040- }
5030+ void handleSyclKernelHandlerType (QualType) {
5031+ // The compiler generated kernel argument used to initialize SYCL 2020
5032+ // specialization constants, `specialization_constants_buffer`, should
5033+ // have corresponding entry in integration header.
5034+ ASTContext &Context = SemaSYCLRef.getASTContext ();
5035+ // Offset is zero since kernel_handler argument is not part of
5036+ // kernel object (i.e. it is not captured)
5037+ addParam (Context.getPointerType (Context.CharTy ),
5038+ SYCLIntegrationHeader::kind_specialization_constants_buffer, 0 );
5039+ }
50415040
5042- bool enterStruct (const CXXRecordDecl *, FieldDecl *FD, QualType Ty) final {
5043- ++StructDepth;
5044- CurOffset += offsetOf (FD, Ty);
5045- return true ;
5046- }
5041+ bool enterStruct (const CXXRecordDecl *, FieldDecl *FD, QualType Ty) final {
5042+ ++StructDepth;
5043+ CurOffset += offsetOf (FD, Ty);
5044+ return true ;
5045+ }
50475046
5048- bool enterStruct (const CXXRecordDecl *, ParmVarDecl *PD,
5049- QualType Ty) final {
5050- addParam (PD, Ty, SYCLIntegrationHeader::kind_struct_with_special_type);
5051- Header.setParentStruct (PD);
5052- return true ;
5053- }
5047+ bool enterStruct (const CXXRecordDecl *, ParmVarDecl *PD, QualType Ty) final {
5048+ addParam (PD, Ty, SYCLIntegrationHeader::kind_struct_with_special_type);
5049+ Header.setParentStruct (PD);
5050+ return true ;
5051+ }
50545052
5055- bool leaveStruct (const CXXRecordDecl *, FieldDecl *FD, QualType Ty) final {
5056- --StructDepth;
5057- CurOffset -= offsetOf (FD, Ty);
5058- return true ;
5059- }
5053+ bool leaveStruct (const CXXRecordDecl *, FieldDecl *FD, QualType Ty) final {
5054+ --StructDepth;
5055+ CurOffset -= offsetOf (FD, Ty);
5056+ return true ;
5057+ }
50605058
5061- bool leaveStruct (const CXXRecordDecl *, ParmVarDecl *, QualType) final {
5062- Header.setParentStruct (nullptr );
5063- return true ;
5064- }
5059+ bool leaveStruct (const CXXRecordDecl *, ParmVarDecl *, QualType) final {
5060+ Header.setParentStruct (nullptr );
5061+ return true ;
5062+ }
50655063
5066- bool enterStruct (const CXXRecordDecl *RD, const CXXBaseSpecifier &BS,
5067- QualType) final {
5068- CurOffset += offsetOf (RD, BS.getType ()->getAsCXXRecordDecl ());
5069- return true ;
5070- }
5064+ bool enterStruct (const CXXRecordDecl *RD, const CXXBaseSpecifier &BS,
5065+ QualType) final {
5066+ CurOffset += offsetOf (RD, BS.getType ()->getAsCXXRecordDecl ());
5067+ return true ;
5068+ }
50715069
5072- bool leaveStruct (const CXXRecordDecl *RD, const CXXBaseSpecifier &BS,
5073- QualType) final {
5074- CurOffset -= offsetOf (RD, BS.getType ()->getAsCXXRecordDecl ());
5075- return true ;
5076- }
5070+ bool leaveStruct (const CXXRecordDecl *RD, const CXXBaseSpecifier &BS,
5071+ QualType) final {
5072+ CurOffset -= offsetOf (RD, BS.getType ()->getAsCXXRecordDecl ());
5073+ return true ;
5074+ }
50775075
5078- bool enterArray (FieldDecl * FD, QualType ArrayTy, QualType) final {
5079- ArrayBaseOffsets.push_back (CurOffset + offsetOf (FD, ArrayTy));
5080- return true ;
5081- }
5076+ bool enterArray (FieldDecl *FD, QualType ArrayTy, QualType) final {
5077+ ArrayBaseOffsets.push_back (CurOffset + offsetOf (FD, ArrayTy));
5078+ return true ;
5079+ }
50825080
5083- bool enterArray (ParmVarDecl *, QualType, QualType) final {
5084- // TODO
5085- unsupportedFreeFunctionParamType ();
5086- return true ;
5087- }
5081+ bool enterArray (ParmVarDecl *, QualType, QualType) final {
5082+ // TODO
5083+ unsupportedFreeFunctionParamType ();
5084+ return true ;
5085+ }
50885086
5089- bool nextElement (QualType ET, uint64_t Index) final {
5090- int64_t Size =
5091- SemaSYCLRef.getASTContext ().getTypeSizeInChars (ET).getQuantity ();
5092- CurOffset = ArrayBaseOffsets.back () + Size * Index;
5093- return true ;
5094- }
5087+ bool nextElement (QualType ET, uint64_t Index) final {
5088+ int64_t Size =
5089+ SemaSYCLRef.getASTContext ().getTypeSizeInChars (ET).getQuantity ();
5090+ CurOffset = ArrayBaseOffsets.back () + Size * Index;
5091+ return true ;
5092+ }
50955093
5096- bool leaveArray (FieldDecl * FD, QualType ArrayTy, QualType) final {
5097- CurOffset = ArrayBaseOffsets.pop_back_val ();
5098- CurOffset -= offsetOf (FD, ArrayTy);
5099- return true ;
5100- }
5094+ bool leaveArray (FieldDecl *FD, QualType ArrayTy, QualType) final {
5095+ CurOffset = ArrayBaseOffsets.pop_back_val ();
5096+ CurOffset -= offsetOf (FD, ArrayTy);
5097+ return true ;
5098+ }
51015099
5102- bool leaveArray (ParmVarDecl *, QualType, QualType) final {
5103- // TODO
5104- unsupportedFreeFunctionParamType ();
5105- return true ;
5106- }
5100+ bool leaveArray (ParmVarDecl *, QualType, QualType) final {
5101+ // TODO
5102+ unsupportedFreeFunctionParamType ();
5103+ return true ;
5104+ }
51075105
5108- using SyclKernelFieldHandler::enterStruct;
5109- using SyclKernelFieldHandler::leaveStruct;
5110- };
5106+ using SyclKernelFieldHandler::enterStruct;
5107+ using SyclKernelFieldHandler::leaveStruct;
5108+ };
51115109
51125110class SyclKernelIntFooterCreator : public SyclKernelFieldHandler {
51135111 SYCLIntegrationFooter &Footer;
0 commit comments