[clang] [Clang] define memory scopes as a builtin enum (PR #185408)
Sameer Sahasrabuddhe via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 26 18:19:40 PDT 2026
================
@@ -1215,6 +1215,84 @@ TypedefDecl *ASTContext::getUInt128Decl() const {
return UInt128Decl;
}
+TypedefDecl *ASTContext::getOrCreateMemoryScopeDecl() {
+ // Return cached value if already created
+ if (MemoryScopeDecl)
+ return MemoryScopeDecl;
+
+ // Check if user has already declared enum __memory_scope
+ // If so, we cannot create our builtin - return nullptr to signal error
+ const char *EnumName = "__memory_scope";
----------------
ssahasra wrote:
> Should this have a clang prefix?
Maybe, but I don't see any specific convention being followed for other things. Should the scoped atomic builtins have been called `__clang_scoped_atomic` builtins? Anyhow, the `__` prefix is reserved for the implementation, and I don't really have a strong opinion on `__clang`.
https://github.com/llvm/llvm-project/pull/185408
More information about the cfe-commits
mailing list