[clang] [C23] Accept an _Atomic underlying type (PR #147802)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 10 06:45:27 PDT 2025
================
@@ -17563,6 +17573,16 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
UPPC_FixedUnderlyingType))
EnumUnderlying = Context.IntTy.getTypePtr();
+ // If the underlying type is atomic, we need to adjust the type before
+ // continuing. This only happens in the case we stored a TypeSourceInfo
+ // into EnumUnderlying because the other cases are error recovery up to
+ // this point. But because it's not possible to gin up a TypeSourceInfo
+ // for a non-atomic type from an atomic one, we'll store into the Type
+ // field instead.
+ if (TypeSourceInfo *TI = dyn_cast<TypeSourceInfo *>(EnumUnderlying);
+ TI && TI->getType()->isAtomicType())
+ EnumUnderlying = TI->getType().getAtomicUnqualifiedType().getTypePtr();
----------------
AaronBallman wrote:
Done!
https://github.com/llvm/llvm-project/pull/147802
More information about the cfe-commits
mailing list