@@ -1131,8 +1131,7 @@ static bool IsFreeFunction(Sema &SemaRef, const FunctionDecl *FD) {
1131
1131
SmallVector<std::pair<std::string, std::string>, 4 > NameValuePairs =
1132
1132
AnAttr->getAttributeNameValuePairs (SemaRef.Context );
1133
1133
for (const auto &NameValuePair : NameValuePairs) {
1134
- if (NameValuePair.first == " sycl-range-kernel" ||
1135
- NameValuePair.first == " sycl-nd-range-kernel" ||
1134
+ if (NameValuePair.first == " sycl-nd-range-kernel" ||
1136
1135
NameValuePair.first == " sycl-single-task-kernel" )
1137
1136
return true ;
1138
1137
}
@@ -1142,8 +1141,7 @@ static bool IsFreeFunction(Sema &SemaRef, const FunctionDecl *FD) {
1142
1141
return false ;
1143
1142
}
1144
1143
1145
- static std::string constructFFKernelName (ASTContext &Ctx,
1146
- const FunctionDecl *FD) {
1144
+ static std::string constructFFKernelName (const FunctionDecl *FD) {
1147
1145
IdentifierInfo *Id = FD->getIdentifier ();
1148
1146
std::string NewIdent = (Twine (" __free_function_" ) + Id->getName ()).str ();
1149
1147
return NewIdent;
@@ -1152,18 +1150,18 @@ static std::string constructFFKernelName(ASTContext &Ctx,
1152
1150
// Gets a name for the free function kernel function. The suffix allows a normal
1153
1151
// device function to coexist with the kernel function.
1154
1152
static std::pair<std::string, std::string>
1155
- constructFreeFunctionKernelName (Sema &S, const FunctionDecl *KernelCallerFunc ,
1153
+ constructFreeFunctionKernelName (Sema &S, const FunctionDecl *FreeFunc ,
1156
1154
MangleContext &MC) {
1157
1155
SmallString<256 > Result;
1158
1156
llvm::raw_svector_ostream Out (Result);
1159
1157
std::string MangledName;
1160
1158
std::string StableName;
1161
1159
1162
- if (KernelCallerFunc ->getTemplateSpecializationArgs ()) {
1163
- MC.mangleName (KernelCallerFunc , Out);
1160
+ if (FreeFunc ->getTemplateSpecializationArgs ()) {
1161
+ MC.mangleName (FreeFunc , Out);
1164
1162
MangledName = (Twine (" __free_function" ) + Out.str ()).str ();
1165
1163
} else {
1166
- MangledName = constructFFKernelName (S. getASTContext (), KernelCallerFunc );
1164
+ MangledName = constructFFKernelName (FreeFunc );
1167
1165
}
1168
1166
StableName = MangledName;
1169
1167
return {MangledName, StableName};
@@ -2759,7 +2757,7 @@ class SyclKernelDeclCreator : public SyclKernelFieldHandler {
2759
2757
FunctionProtoType::ExtProtoInfo Info (CC_OpenCLKernel);
2760
2758
QualType FuncType = Ctx.getFunctionType (Ctx.VoidTy , {}, Info);
2761
2759
const IdentifierInfo *NewIdent =
2762
- &Ctx.Idents .get (constructFFKernelName (Ctx, FD));
2760
+ &Ctx.Idents .get (constructFFKernelName (FD));
2763
2761
FD = FunctionDecl::Create (
2764
2762
Ctx, Ctx.getTranslationUnitDecl (), Loc, Loc, DeclarationName (NewIdent),
2765
2763
FuncType, Ctx.getTrivialTypeSourceInfo (Ctx.VoidTy ), SC_None);
0 commit comments