Skip to content

Commit e662262

Browse files
author
aidan.belton
committed
Remove unneccessary parameter in isSyclAccessorType
1 parent 626a101 commit e662262

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ class Util {
111111
/// \param Tmpl whether the class is template instantiation or simple record
112112
static bool isSyclType(QualType Ty, StringRef Name, bool Tmpl = false);
113113

114-
/// Checks whether given clang type is a standard SYCL API accessor class.
114+
/// Checks whether given clang type is a standard SYCL API accessor class,
115+
/// the check assumes the type is templated.
115116
/// \param Ty the clang type being checked
116-
/// \param Tmpl whether the class is template instantiation or simple record
117-
static bool isSyclAccessorType(QualType Ty, bool Tmpl = false);
117+
static bool isSyclAccessorType(QualType Ty);
118118

119119
/// Checks whether given clang type is a full specialization of the SYCL
120120
/// specialization constant class.
@@ -1624,7 +1624,7 @@ class SyclKernelFieldChecker : public SyclKernelFieldHandler {
16241624
assert(Util::isSyclSpecialType(Ty) &&
16251625
"Should only be called on sycl special class types.");
16261626
const RecordDecl *RecD = Ty->getAsRecordDecl();
1627-
if (IsSIMD && !Util::isSyclAccessorType(Ty, true /*Tmp*/))
1627+
if (IsSIMD && !Util::isSyclAccessorType(Ty))
16281628
return SemaRef.Diag(Loc.getBegin(),
16291629
diag::err_sycl_esimd_not_supported_for_type)
16301630
<< RecD;
@@ -1966,8 +1966,7 @@ class SyclKernelDeclCreator : public SyclKernelFieldHandler {
19661966
const auto *RecordDecl = FieldTy->getAsCXXRecordDecl();
19671967
assert(RecordDecl && "The type must be a RecordDecl");
19681968
llvm::StringLiteral MethodName =
1969-
KernelDecl->hasAttr<SYCLSimdAttr>() &&
1970-
Util::isSyclAccessorType(FieldTy, true /*Tmp*/)
1969+
KernelDecl->hasAttr<SYCLSimdAttr>() && Util::isSyclAccessorType(FieldTy)
19711970
? InitESIMDMethodName
19721971
: InitMethodName;
19731972
CXXMethodDecl *InitMethod = getMethodByName(RecordDecl, MethodName);
@@ -1992,7 +1991,7 @@ class SyclKernelDeclCreator : public SyclKernelFieldHandler {
19921991
// added, this code needs to be refactored to call
19931992
// handleAccessorPropertyList for each class which requires it.
19941993
if (ParamTy.getTypePtr()->isPointerType() &&
1995-
Util::isSyclAccessorType(FieldTy, true /*Tmp*/))
1994+
Util::isSyclAccessorType(FieldTy))
19961995
handleAccessorType(FieldTy, RecordDecl, FD->getBeginLoc());
19971996
}
19981997
LastParamIndex = ParamIndex;
@@ -2087,8 +2086,7 @@ class SyclKernelDeclCreator : public SyclKernelFieldHandler {
20872086
const auto *RecordDecl = FieldTy->getAsCXXRecordDecl();
20882087
assert(RecordDecl && "The type must be a RecordDecl");
20892088
llvm::StringLiteral MethodName =
2090-
KernelDecl->hasAttr<SYCLSimdAttr>() &&
2091-
Util::isSyclAccessorType(FieldTy, true /*Tmp*/)
2089+
KernelDecl->hasAttr<SYCLSimdAttr>() && Util::isSyclAccessorType(FieldTy)
20922090
? InitESIMDMethodName
20932091
: InitMethodName;
20942092
CXXMethodDecl *InitMethod = getMethodByName(RecordDecl, MethodName);
@@ -2107,7 +2105,7 @@ class SyclKernelDeclCreator : public SyclKernelFieldHandler {
21072105
// added, this code needs to be refactored to call
21082106
// handleAccessorPropertyList for each class which requires it.
21092107
if (ParamTy.getTypePtr()->isPointerType() &&
2110-
Util::isSyclAccessorType(FieldTy, true /*Tmp*/))
2108+
Util::isSyclAccessorType(FieldTy))
21112109
handleAccessorType(FieldTy, RecordDecl, BS.getBeginLoc());
21122110
}
21132111
LastParamIndex = ParamIndex;
@@ -2229,9 +2227,8 @@ class SyclKernelArgsSizeChecker : public SyclKernelFieldHandler {
22292227
const CXXRecordDecl *RecordDecl = FieldTy->getAsCXXRecordDecl();
22302228
assert(RecordDecl && "The type must be a RecordDecl");
22312229
llvm::StringLiteral MethodName =
2232-
(IsSIMD && Util::isSyclAccessorType(FieldTy, true /*Tmp*/))
2233-
? InitESIMDMethodName
2234-
: InitMethodName;
2230+
(IsSIMD && Util::isSyclAccessorType(FieldTy)) ? InitESIMDMethodName
2231+
: InitMethodName;
22352232
CXXMethodDecl *InitMethod = getMethodByName(RecordDecl, MethodName);
22362233
assert(InitMethod && "The type must have the __init method");
22372234
for (const ParmVarDecl *Param : InitMethod->parameters())
@@ -3148,7 +3145,7 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
31483145
bool handleSyclSpecialType(FieldDecl *FD, QualType FieldTy) final {
31493146
const auto *ClassTy = FieldTy->getAsCXXRecordDecl();
31503147
assert(ClassTy && "Type must be a C++ record type");
3151-
if (Util::isSyclAccessorType(FieldTy, true /*Tmp*/)) {
3148+
if (Util::isSyclAccessorType(FieldTy)) {
31523149
const auto *AccTy =
31533150
cast<ClassTemplateSpecializationDecl>(FieldTy->getAsRecordDecl());
31543151
assert(AccTy->getTemplateArgs().size() >= 2 &&
@@ -5209,9 +5206,9 @@ bool Util::isSyclType(QualType Ty, StringRef Name, bool Tmpl) {
52095206
return matchQualifiedTypeName(Ty, Scopes);
52105207
}
52115208

5212-
bool Util::isSyclAccessorType(QualType Ty, bool Tmpl) {
5213-
return isSyclType(Ty, "accessor", Tmpl) ||
5214-
isSyclType(Ty, "local_accessor", Tmpl);
5209+
bool Util::isSyclAccessorType(QualType Ty) {
5210+
return isSyclType(Ty, "accessor", true /* Tmpl */) ||
5211+
isSyclType(Ty, "local_accessor", true /* Tmpl */);
52155212
}
52165213

52175214
bool Util::isAccessorPropertyListType(QualType Ty) {

0 commit comments

Comments
 (0)