================
@@ -312,3 +313,26 @@ void clang::takeAndConcatenateAttrs(ParsedAttributes
&First,
if (Second.Range.getEnd().isValid())
First.Range.setEnd(Second.Range.getEnd());
}
+
+LangAS ParsedAttr::asLangAS() const {
+ switch (getParsedKind()) {
+ case ParsedAttr::AT_OffloadGlobalAddressSpace:
+ return OffloadGlobalAddressSpaceAttr::getLangAS(*this);
+ case ParsedAttr::AT_OffloadGlobalDeviceAddressSpace:
+ return OffloadGlobalDeviceAddressSpaceAttr::getLangAS(*this);
+ case ParsedAttr::AT_OffloadGlobalHostAddressSpace:
+ return OffloadGlobalHostAddressSpaceAttr::getLangAS(*this);
+ case ParsedAttr::AT_OffloadLocalAddressSpace:
+ return OffloadLocalAddressSpaceAttr::getLangAS(*this);
+ case ParsedAttr::AT_OffloadPrivateAddressSpace:
+ return OffloadPrivateAddressSpaceAttr::getLangAS(*this);
+ case ParsedAttr::AT_OffloadConstantAddressSpace:
+ return OffloadConstantAddressSpaceAttr::getLangAS(*this);
+ case ParsedAttr::AT_OffloadGenericAddressSpace:
+ return OffloadGenericAddressSpaceAttr::getLangAS(*this);
+ case ParsedAttr::AT_HLSLGroupSharedAddressSpace:
+ return LangAS::hlsl_groupshared;
+ default:
+ return LangAS::Default;
+ }
+}
----------------
elizabethandrews wrote:
>We can't, as far as I know, use the LangOpts declarative approach for the
>combined OpenCP and SYCL address spaces since that would require
>differentiation based on spelling, so perhaps that is reasonable motivation
>for defining distinct attributes (as we discussed earlier today).
I guess my question is what is the purpose of the new attributes and to be
honest also using OpenCL spelling in SYCL code if attribute behavior is
semantically similar. Is your concern purely about diagnostics being strange?
Because diagnostics can just be reworded to say `global address space` instead
of `sycl_global` and `__global`. IMO the differentiation/warnings between
spellings (as in done in the second commit of this PR and proposed warnings)
for SYCL vs OpenCL is overkill. I personally do not see the problem with
considering them equivalent with mapping done based on LangOpts.
https://github.com/llvm/llvm-project/pull/200849
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits