================
@@ -798,6 +798,13 @@ static void InitializePredefinedMacros(const TargetInfo 
&TI,
   Builder.defineMacro("__ATOMIC_ACQ_REL", "4");
   Builder.defineMacro("__ATOMIC_SEQ_CST", "5");
 
+  // Define macros for the clang atomic scopes.
+  Builder.defineMacro("__MEMORY_SCOPE_SYSTEM", "0");
+  Builder.defineMacro("__MEMORY_SCOPE_DEVICE", "1");
+  Builder.defineMacro("__MEMORY_SCOPE_WRKGRP", "2");
+  Builder.defineMacro("__MEMORY_SCOPE_WVFRNT", "3");
+  Builder.defineMacro("__MEMORY_SCOPE_SINGLE", "4");
+
----------------
ssahasra wrote:

The values chosen for these "clang" macros are rather unfortunate. They 
conflict with both OpenCL and HIP. At least OpenCL and HIP are mutually 
exclusive, so the conflict is benign. But these Clang macros can be used inside 
any language, and the mismatching numerical values make it impossible to catch 
errors when say the user calls a Clang builtin with a __HIP scope, or vice 
versa.

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

Reply via email to