[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 04:12:31 PST 2023


================
@@ -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");
+
----------------
jhuber6 wrote:

We could, though I might need to think of some better names. It's difficult to cover all the cases people might need. I think that cleanup would best be done in a follow-up patch.

https://github.com/llvm/llvm-project/pull/72280


More information about the cfe-commits mailing list