Skip to content

Commit c38d9f4

Browse files
committed
1. Fix format 2. replace "llvm::Attribute::NoAlias with "noalias"
3. replace variable names with string literals
1 parent 9bbe8f9 commit c38d9f4

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1703,8 +1703,8 @@ void CodeGenModule::GenOpenCLArgMetadata(llvm::Function *Fn,
17031703

17041704
if (LangOpts.SYCLIsDevice && !IsEsimdFunction) {
17051705

1706-
Fn->setMetadata(llvm::Attribute::NoAlias,
1707-
llvm::MDNode::get(VMContext, argAccessorNoAliasPropertyAttr));
1706+
Fn->setMetadata("noalias", llvm::MDNode::get(
1707+
VMContext, argAccessorNoAliasPropertyAttr));
17081708

17091709
Fn->setMetadata("kernel_arg_buffer_location",
17101710
llvm::MDNode::get(VMContext, argSYCLBufferLocationAttr));

clang/lib/Sema/SemaSYCL.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class Util {
9292

9393
/// Checks whether given clang type is a full specialization of the SYCL
9494
/// no_alias class.
95-
static bool isSyclAccessorNoAliasPropertyType(const QualType &Ty);
95+
static bool isSyclAccessorNoAliasPropertyType(QualType Ty);
9696

9797
/// Checks whether given clang type is a full specialization of the SYCL
9898
/// buffer_location class.
@@ -1754,7 +1754,7 @@ class SyclKernelDeclCreator : public SyclKernelFieldHandler {
17541754
}
17551755

17561756
void handleNoAliasProperty(ParmVarDecl *Param, QualType PropTy,
1757-
SourceLocation Loc) {
1757+
SourceLocation Loc) {
17581758
if (PropTy.isRestrictQualified()) {
17591759
ASTContext &Ctx = SemaRef.getASTContext();
17601760
Param->addAttr(RestrictAttr::CreateImplicit(Ctx, Loc));
@@ -4328,16 +4328,14 @@ bool Util::isSyclKernelHandlerType(const QualType &Ty) {
43284328
}
43294329

43304330
bool Util::isSyclAccessorNoAliasPropertyType(QualType Ty) {
4331-
StringRef PropertyName = "no_alias";
4332-
StringRef InstanceName = "instance";
43334331
std::array<DeclContextDesc, 6> Scopes = {
43344332
Util::DeclContextDesc{Decl::Kind::Namespace, "cl"},
43354333
Util::DeclContextDesc{Decl::Kind::Namespace, "sycl"},
43364334
Util::DeclContextDesc{Decl::Kind::Namespace, "ONEAPI"},
43374335
Util::DeclContextDesc{Decl::Kind::Namespace, "property"},
4338-
Util::DeclContextDesc{Decl::Kind::CXXRecord, PropertyName},
4336+
Util::DeclContextDesc{Decl::Kind::CXXRecord, "no_alias"},
43394337
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization,
4340-
InstanceName}};
4338+
"instance"}};
43414339
return matchQualifiedTypeName(Ty, Scopes);
43424340
}
43434341

0 commit comments

Comments
 (0)