From eaf33969a4439c619ca360e20a338411cc53ff61 Mon Sep 17 00:00:00 2001 From: Mariya Podchishchaeva Date: Thu, 2 Jul 2020 22:08:21 +0300 Subject: [PATCH] [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. --- clang/lib/Sema/SemaSYCL.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index b7ca9aa85739e..3b3976a21fc01 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -1589,7 +1589,7 @@ class SyclKernelBodyCreator class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler { SYCLIntegrationHeader &Header; - const CXXRecordDecl *KernelLambda; + const CXXRecordDecl *KernelObj; // Necessary to figure out the offset of the base class. const CXXRecordDecl *CurStruct = nullptr; int64_t CurOffset = 0; @@ -1608,11 +1608,10 @@ class SyclKernelIntHeaderCreator public: SyclKernelIntHeaderCreator(Sema &S, SYCLIntegrationHeader &H, - const CXXRecordDecl *KernelLambda, - QualType NameType, StringRef Name, - StringRef StableName) - : SyclKernelFieldHandler(S), Header(H), KernelLambda(KernelLambda) { - Header.startKernel(Name, NameType, StableName, KernelLambda->getLocation()); + const CXXRecordDecl *KernelObj, QualType NameType, + StringRef Name, StringRef StableName) + : SyclKernelFieldHandler(S), Header(H), KernelObj(KernelObj) { + Header.startKernel(Name, NameType, StableName, KernelObj->getLocation()); } bool handleSyclAccessorType(const CXXBaseSpecifier &BC, @@ -1773,8 +1772,8 @@ class SyclKernelIntHeaderCreator void Sema::ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc, MangleContext &MC) { // The first argument to the KernelCallerFunc is the lambda object. - CXXRecordDecl *KernelLambda = getKernelObjectType(KernelCallerFunc); - assert(KernelLambda && "invalid kernel caller"); + CXXRecordDecl *KernelObj = getKernelObjectType(KernelCallerFunc); + assert(KernelObj && "invalid kernel caller"); // Calculate both names, since Integration headers need both. std::string CalculatedName, StableName; @@ -1784,17 +1783,17 @@ void Sema::ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc, : CalculatedName); SyclKernelFieldChecker checker(*this); SyclKernelDeclCreator kernel_decl( - *this, checker, KernelName, KernelLambda->getLocation(), + *this, checker, KernelName, KernelObj->getLocation(), KernelCallerFunc->isInlined(), KernelCallerFunc->hasAttr()); - SyclKernelBodyCreator kernel_body(*this, kernel_decl, KernelLambda, + SyclKernelBodyCreator kernel_body(*this, kernel_decl, KernelObj, KernelCallerFunc); SyclKernelIntHeaderCreator int_header( - *this, getSyclIntegrationHeader(), KernelLambda, + *this, getSyclIntegrationHeader(), KernelObj, calculateKernelNameType(Context, KernelCallerFunc), KernelName, StableName); ConstructingOpenCLKernel = true; - VisitRecordFields(KernelLambda->fields(), checker, kernel_decl, kernel_body, + VisitRecordFields(KernelObj->fields(), checker, kernel_decl, kernel_body, int_header); ConstructingOpenCLKernel = false; }