================ @@ -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:
Ah! Because we want to keep the `TypeSourceInfo *` whenever possible (it carries more information than a `Type *`). But ginning up a `TypeSourceInfo *` for a part of a different type is nontrivial; we may want to do it someday, but it seemed like overkill to solve this issue. So in the atomic case we degrade the information a little bit by storing a `Type *` instead of a `TypeSourceInfo *`, but in usual cases we still store the `TypeSourceInfo *` we got. https://github.com/llvm/llvm-project/pull/147802 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits