================
@@ -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:

>>Once the attributes are limited to use in their appropriate modes, mapping 
>>becomes easier and mode based.

Prior to this PR, LangAS was mapped according to compilation mode, i.e. 
LangOpts. There were separate mapping functions selected based on LangOpts. My 
understanding was that you were not a fan of that and wanted mappings done 
based on spellings, which is why this change was made. I can revert to the old 
code AND also adding a spelling check if that is what you prefer.

https://github.com/llvm/llvm-project/pull/200849
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to