@@ -82,8 +82,8 @@ class Util {
8282 static bool isSyclHalfType (const QualType &Ty);
8383
8484 // / Checks whether given clang type is a full specialization of the SYCL
85- // / property_list class.
86- static bool isPropertyListType (const QualType &Ty);
85+ // / accessor_property_list class.
86+ static bool isAccessorPropertyListType (const QualType &Ty);
8787
8888 // / Checks whether given clang type is a full specialization of the SYCL
8989 // / buffer_location class.
@@ -1194,29 +1194,31 @@ class SyclKernelFieldChecker : public SyclKernelFieldHandler {
11941194 return ;
11951195 }
11961196 QualType PropListTy = PropList.getAsType ();
1197- if (!Util::isPropertyListType (PropListTy)) {
1197+ if (!Util::isAccessorPropertyListType (PropListTy)) {
11981198 SemaRef.Diag (Loc,
11991199 diag::err_sycl_invalid_accessor_property_template_param);
12001200 return ;
12011201 }
1202- const auto *PropListDecl =
1202+ const auto *AccPropListDecl =
12031203 cast<ClassTemplateSpecializationDecl>(PropListTy->getAsRecordDecl ());
1204- if (PropListDecl ->getTemplateArgs ().size () != 1 ) {
1204+ if (AccPropListDecl ->getTemplateArgs ().size () != 1 ) {
12051205 SemaRef.Diag (Loc, diag::err_sycl_invalid_property_list_param_number)
1206- << " property_list " ;
1206+ << " accessor_property_list " ;
12071207 return ;
12081208 }
1209- const auto TemplArg = PropListDecl ->getTemplateArgs ()[0 ];
1209+ const auto TemplArg = AccPropListDecl ->getTemplateArgs ()[0 ];
12101210 if (TemplArg.getKind () != TemplateArgument::ArgKind::Pack) {
1211- SemaRef.Diag (Loc, diag::err_sycl_invalid_property_list_template_param)
1212- << /* property_list*/ 0 << /* parameter pack*/ 0 ;
1211+ SemaRef.Diag (Loc,
1212+ diag::err_sycl_invalid_accessor_property_list_template_param)
1213+ << /* accessor_property_list*/ 0 << /* parameter pack*/ 0 ;
12131214 return ;
12141215 }
12151216 for (TemplateArgument::pack_iterator Prop = TemplArg.pack_begin ();
12161217 Prop != TemplArg.pack_end (); ++Prop) {
12171218 if (Prop->getKind () != TemplateArgument::ArgKind::Type) {
1218- SemaRef.Diag (Loc, diag::err_sycl_invalid_property_list_template_param)
1219- << /* property_list pack argument*/ 1 << /* type*/ 1 ;
1219+ SemaRef.Diag (
1220+ Loc, diag::err_sycl_invalid_accessor_property_list_template_param)
1221+ << /* accessor_property_list pack argument*/ 1 << /* type*/ 1 ;
12201222 return ;
12211223 }
12221224 QualType PropTy = Prop->getAsType ();
@@ -1235,13 +1237,15 @@ class SyclKernelFieldChecker : public SyclKernelFieldHandler {
12351237 }
12361238 const auto BufferLoc = PropDecl->getTemplateArgs ()[0 ];
12371239 if (BufferLoc.getKind () != TemplateArgument::ArgKind::Integral) {
1238- SemaRef.Diag (Loc, diag::err_sycl_invalid_property_list_template_param)
1240+ SemaRef.Diag (Loc,
1241+ diag::err_sycl_invalid_accessor_property_list_template_param)
12391242 << /* buffer_location*/ 2 << /* non-negative integer*/ 2 ;
12401243 return ;
12411244 }
12421245 int LocationID = static_cast <int >(BufferLoc.getAsIntegral ().getExtValue ());
12431246 if (LocationID < 0 ) {
1244- SemaRef.Diag (Loc, diag::err_sycl_invalid_property_list_template_param)
1247+ SemaRef.Diag (Loc,
1248+ diag::err_sycl_invalid_accessor_property_list_template_param)
12451249 << /* buffer_location*/ 2 << /* non-negative integer*/ 2 ;
12461250 return ;
12471251 }
@@ -1414,19 +1418,18 @@ class SyclKernelDeclCreator : public SyclKernelFieldHandler {
14141418 }
14151419
14161420 // Handle accessor properties. If any properties were found in
1417- // the property_list - add the appropriate attributes to ParmVarDecl.
1421+ // the accessor_property_list - add the appropriate attributes to ParmVarDecl.
14181422 void handleAccessorPropertyList (ParmVarDecl *Param,
14191423 const CXXRecordDecl *RecordDecl,
14201424 SourceLocation Loc) {
14211425 const auto *AccTy = cast<ClassTemplateSpecializationDecl>(RecordDecl);
1422- // TODO: when SYCL headers' part is ready - replace this 'if' with an error
14231426 if (AccTy->getTemplateArgs ().size () < 6 )
14241427 return ;
14251428 const auto PropList = cast<TemplateArgument>(AccTy->getTemplateArgs ()[5 ]);
14261429 QualType PropListTy = PropList.getAsType ();
1427- const auto *PropListDecl =
1430+ const auto *AccPropListDecl =
14281431 cast<ClassTemplateSpecializationDecl>(PropListTy->getAsRecordDecl ());
1429- const auto TemplArg = PropListDecl ->getTemplateArgs ()[0 ];
1432+ const auto TemplArg = AccPropListDecl ->getTemplateArgs ()[0 ];
14301433 // Move through TemplateArgs list of a property list and search for
14311434 // properties. If found - apply the appropriate attribute to ParmVarDecl.
14321435 for (TemplateArgument::pack_iterator Prop = TemplArg.pack_begin ();
@@ -3455,20 +3458,17 @@ bool Util::isSyclSpecConstantType(const QualType &Ty) {
34553458 return matchQualifiedTypeName (Ty, Scopes);
34563459}
34573460
3458- bool Util::isPropertyListType (const QualType &Ty) {
3459- return isSyclType (Ty, " property_list" , true /* Tmpl*/ );
3460- }
3461-
34623461bool Util::isSyclBufferLocationType (const QualType &Ty) {
3463- const StringRef &Name = " buffer_location" ;
3464- std::array<DeclContextDesc, 4 > Scopes = {
3465- Util::DeclContextDesc{clang::Decl::Kind::Namespace, " cl" },
3466- Util::DeclContextDesc{clang::Decl::Kind::Namespace, " sycl" },
3467- // TODO: this doesn't belong to property namespace, instead it shall be
3468- // in its own namespace. Change it, when the actual implementation in SYCL
3469- // headers is ready
3470- Util::DeclContextDesc{clang::Decl::Kind::Namespace, " property" },
3471- Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization, Name}};
3462+ const StringRef &PropertyName = " buffer_location" ;
3463+ const StringRef &InstanceName = " instance" ;
3464+ std::array<DeclContextDesc, 6 > Scopes = {
3465+ Util::DeclContextDesc{Decl::Kind::Namespace, " cl" },
3466+ Util::DeclContextDesc{Decl::Kind::Namespace, " sycl" },
3467+ Util::DeclContextDesc{Decl::Kind::Namespace, " INTEL" },
3468+ Util::DeclContextDesc{Decl::Kind::Namespace, " property" },
3469+ Util::DeclContextDesc{Decl::Kind::CXXRecord, PropertyName},
3470+ Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization,
3471+ InstanceName}};
34723472 return matchQualifiedTypeName (Ty, Scopes);
34733473}
34743474
@@ -3482,6 +3482,16 @@ bool Util::isSyclType(const QualType &Ty, StringRef Name, bool Tmpl) {
34823482 return matchQualifiedTypeName (Ty, Scopes);
34833483}
34843484
3485+ bool Util::isAccessorPropertyListType (const QualType &Ty) {
3486+ const StringRef &Name = " accessor_property_list" ;
3487+ std::array<DeclContextDesc, 4 > Scopes = {
3488+ Util::DeclContextDesc{clang::Decl::Kind::Namespace, " cl" },
3489+ Util::DeclContextDesc{clang::Decl::Kind::Namespace, " sycl" },
3490+ Util::DeclContextDesc{clang::Decl::Kind::Namespace, " ONEAPI" },
3491+ Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization, Name}};
3492+ return matchQualifiedTypeName (Ty, Scopes);
3493+ }
3494+
34853495bool Util::matchQualifiedTypeName (const QualType &Ty,
34863496 ArrayRef<Util::DeclContextDesc> Scopes) {
34873497 // The idea: check the declaration context chain starting from the type
0 commit comments