[llvm-branch-commits] [clang] [Clang] define memory scopes as a builtin enum (PR #185408)

Sameer Sahasrabuddhe via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 11 06:56:02 PDT 2026


ssahasra wrote:

> They're integers because this is the idiomatic expansion for runtime values https://godbolt.org/z/ddnzWMYvh. Does this break this usage?

No that runtime expansion need not change, which is why the proposed enum matches the current integer values. But that call to `__scoped_atomic_fence` with an `int` scope argument will produce a warning. Do you see any problem with informing the user that the function `fence()` should be redefined with a `__memory_scope` argument instead of `int`?

```
void fence(int ord, __memory_scope scope) {
    __scoped_atomic_thread_fence(ord, scope); // no more warning
}
```

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


More information about the llvm-branch-commits mailing list