Skip to content

Commit eaf3396

Browse files
authored
[SYCL][NFC] Rename KernelLambda to KernelObj (#2031)
These variables can also represent a function object, so they have CXXRecordDecl type and the name KernelLambda is confusing and incorrect in this case.
1 parent 95d3ec6 commit eaf3396

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

clang/lib/Sema/SemaSYCL.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ class SyclKernelBodyCreator
15891589
class SyclKernelIntHeaderCreator
15901590
: public SyclKernelFieldHandler<SyclKernelIntHeaderCreator> {
15911591
SYCLIntegrationHeader &Header;
1592-
const CXXRecordDecl *KernelLambda;
1592+
const CXXRecordDecl *KernelObj;
15931593
// Necessary to figure out the offset of the base class.
15941594
const CXXRecordDecl *CurStruct = nullptr;
15951595
int64_t CurOffset = 0;
@@ -1608,11 +1608,10 @@ class SyclKernelIntHeaderCreator
16081608

16091609
public:
16101610
SyclKernelIntHeaderCreator(Sema &S, SYCLIntegrationHeader &H,
1611-
const CXXRecordDecl *KernelLambda,
1612-
QualType NameType, StringRef Name,
1613-
StringRef StableName)
1614-
: SyclKernelFieldHandler(S), Header(H), KernelLambda(KernelLambda) {
1615-
Header.startKernel(Name, NameType, StableName, KernelLambda->getLocation());
1611+
const CXXRecordDecl *KernelObj, QualType NameType,
1612+
StringRef Name, StringRef StableName)
1613+
: SyclKernelFieldHandler(S), Header(H), KernelObj(KernelObj) {
1614+
Header.startKernel(Name, NameType, StableName, KernelObj->getLocation());
16161615
}
16171616

16181617
bool handleSyclAccessorType(const CXXBaseSpecifier &BC,
@@ -1773,8 +1772,8 @@ class SyclKernelIntHeaderCreator
17731772
void Sema::ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc,
17741773
MangleContext &MC) {
17751774
// The first argument to the KernelCallerFunc is the lambda object.
1776-
CXXRecordDecl *KernelLambda = getKernelObjectType(KernelCallerFunc);
1777-
assert(KernelLambda && "invalid kernel caller");
1775+
CXXRecordDecl *KernelObj = getKernelObjectType(KernelCallerFunc);
1776+
assert(KernelObj && "invalid kernel caller");
17781777

17791778
// Calculate both names, since Integration headers need both.
17801779
std::string CalculatedName, StableName;
@@ -1784,17 +1783,17 @@ void Sema::ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc,
17841783
: CalculatedName);
17851784
SyclKernelFieldChecker checker(*this);
17861785
SyclKernelDeclCreator kernel_decl(
1787-
*this, checker, KernelName, KernelLambda->getLocation(),
1786+
*this, checker, KernelName, KernelObj->getLocation(),
17881787
KernelCallerFunc->isInlined(), KernelCallerFunc->hasAttr<SYCLSimdAttr>());
1789-
SyclKernelBodyCreator kernel_body(*this, kernel_decl, KernelLambda,
1788+
SyclKernelBodyCreator kernel_body(*this, kernel_decl, KernelObj,
17901789
KernelCallerFunc);
17911790
SyclKernelIntHeaderCreator int_header(
1792-
*this, getSyclIntegrationHeader(), KernelLambda,
1791+
*this, getSyclIntegrationHeader(), KernelObj,
17931792
calculateKernelNameType(Context, KernelCallerFunc), KernelName,
17941793
StableName);
17951794

17961795
ConstructingOpenCLKernel = true;
1797-
VisitRecordFields(KernelLambda->fields(), checker, kernel_decl, kernel_body,
1796+
VisitRecordFields(KernelObj->fields(), checker, kernel_decl, kernel_body,
17981797
int_header);
17991798
ConstructingOpenCLKernel = false;
18001799
}

0 commit comments

Comments
 (0)