Skip to content

Commit cbab06d

Browse files
committed
address review comments
Signed-off-by: Soumi Manna <[email protected]>
1 parent eff1258 commit cbab06d

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9987,8 +9987,8 @@ class Sema final {
99879987
void AddIntelFPGABankBitsAttr(Decl *D, const AttributeCommonInfo &CI,
99889988
Expr **Exprs, unsigned Size);
99899989
template <typename AttrType>
9990-
void addIntelSYCLFunctionAttr(Decl *D, const AttributeCommonInfo &CI,
9991-
Expr *E);
9990+
void addIntelSYCLSingleArgFunctionAttr(Decl *D,
9991+
const AttributeCommonInfo &CI, Expr *E);
99929992
/// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
99939993
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
99949994
bool IsPackExpansion);
@@ -12835,28 +12835,29 @@ class Sema final {
1283512835
};
1283612836

1283712837
template <typename AttrType>
12838-
void Sema::addIntelSYCLFunctionAttr(Decl *D, const AttributeCommonInfo &Attr,
12839-
Expr *E) {
12838+
void Sema::addIntelSYCLSingleArgFunctionAttr(Decl *D,
12839+
const AttributeCommonInfo &CI,
12840+
Expr *E) {
1284012841
if (!E)
1284112842
return;
1284212843

1284312844
if (!E->isInstantiationDependent()) {
1284412845
Optional<llvm::APSInt> ArgVal = E->getIntegerConstantExpr(getASTContext());
1284512846
if (!ArgVal) {
1284612847
Diag(E->getExprLoc(), diag::err_attribute_argument_type)
12847-
<< Attr.getAttrName() << AANT_ArgumentIntegerConstant
12848+
<< CI.getAttrName() << AANT_ArgumentIntegerConstant
1284812849
<< E->getSourceRange();
1284912850
return;
1285012851
}
1285112852
int32_t ArgInt = ArgVal->getSExtValue();
1285212853
if (ArgInt <= 0) {
1285312854
Diag(E->getExprLoc(), diag::err_attribute_requires_positive_integer)
12854-
<< Attr.getAttrName() << /*positive*/ 0;
12855+
<< CI.getAttrName() << /*positive*/ 0;
1285512856
return;
1285612857
}
1285712858
}
1285812859

12859-
D->addAttr(::new (Context) AttrType(Context, Attr, E));
12860+
D->addAttr(::new (Context) AttrType(Context, CI, E));
1286012861
}
1286112862

1286212863
template <typename AttrType>

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,7 +2988,7 @@ static void handleSubGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
29882988
if (D->getAttr<IntelReqdSubGroupSizeAttr>())
29892989
S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL;
29902990

2991-
S.addIntelSYCLFunctionAttr<IntelReqdSubGroupSizeAttr>(D, AL, E);
2991+
S.addIntelSYCLSingleArgFunctionAttr<IntelReqdSubGroupSizeAttr>(D, AL, E);
29922992
}
29932993

29942994
// Handles num_simd_work_items.
@@ -3002,7 +3002,7 @@ static void handleNumSimdWorkItemsAttr(Sema &S, Decl *D,
30023002
if (D->getAttr<SYCLIntelNumSimdWorkItemsAttr>())
30033003
S.Diag(Attr.getLoc(), diag::warn_duplicate_attribute) << Attr;
30043004

3005-
S.addIntelSYCLFunctionAttr<SYCLIntelNumSimdWorkItemsAttr>(D, Attr, E);
3005+
S.addIntelSYCLSingleArgFunctionAttr<SYCLIntelNumSimdWorkItemsAttr>(D, Attr, E);
30063006
}
30073007

30083008
// Handles max_global_work_dim.

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ static void instantiateIntelSYCLFunctionAttr(
549549
S, Sema::ExpressionEvaluationContext::ConstantEvaluated);
550550
ExprResult Result = S.SubstExpr(Attr->getValue(), TemplateArgs);
551551
if (!Result.isInvalid())
552-
S.addIntelSYCLFunctionAttr<AttrName>(New, *Attr, Result.getAs<Expr>());
552+
S.addIntelSYCLSingleArgFunctionAttr<AttrName>(New, *Attr,
553+
Result.getAs<Expr>());
553554
}
554555

555556
void Sema::InstantiateAttrsForDecl(

0 commit comments

Comments
 (0)