[Lldb-commits] [lldb] [lldb][NativePDB] Complete enums when they are created (PR #233461)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 20 07:59:09 PDT 2026
charles-zablit wrote:
> > `Sema` reads an enum's promotion type directly during integral promotion, and that is only set once the definition is complete. This means that expressions with an enum not yet completed hit an assert in `clang` (`Sema::IsIntegralPromotion`, or CodeGen's `"Emitted constant has unexpected size"`).
>
> Isn't this more of an issue on the Clang/TypeSystemClang side? If it allows us to create uncompleted enums, it should make sure they're completed when they need to be.
Clang never asks for the complete enums: an enum with an integer type counts as complete (`EnumDecl::isComplete()` is `isCompleteDefinition() || IntegerType`)
https://github.com/llvm/llvm-project/blob/a84bb87f96bb150357197b3603d78c3016cb31d8/clang/include/clang/AST/Decl.h#L4382-L4386
`TypeSystemClang::CreateEnumerationType` always sets the integer type, so `Sema::RequireCompleteType` never calls `ExternalASTSource::CompleteType(tag)`.
Only the code that reads what `completeDefinition` is supposed to set breaks: the null promotion type in `Sema::IsIntegralPromotion`, and CodeGen's `i32` placeholder for incomplete non fixed enums.
`TypeSystemClang` assumes enums are complete once created (see `RequireCompleteType`), and the DWARF and DIA parsers both complete them on creation.
https://github.com/llvm/llvm-project/pull/233461
More information about the lldb-commits
mailing list