[clang] [RFC][Clang] Add the __addrspaceof operator (PR #210242)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 6 10:47:27 PDT 2026
================
@@ -5602,6 +5602,22 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity,
MangleAlignofSizeofArg();
break;
+ case UETT_AddrSpaceOf: {
+ if (SAE->isArgumentType()) {
+ MangleExtensionBuiltin(SAE);
+ break;
+ }
+
+ // Normal expression mangling ignores parentheses, but __addrspaceof(x)
+ // and __addrspaceof((x)) can have different values. Record whether the
+ // operand uses the entity form before mangling the operand itself.
+ mangleVendorType(getTraitSpelling(SAE->getKind()));
+ bool IsEntity = isUnparenthesizedIdOrMemberExpr(SAE->getArgumentExpr());
+ Out << (IsEntity ? "Lb1E" : "Lb0E");
----------------
AaronBallman wrote:
Be sure to add tests which require a microsoft ABI to ensure we do something sensible there.
https://github.com/llvm/llvm-project/pull/210242
More information about the cfe-commits
mailing list