Skip to content

Commit 8f08b75

Browse files
authored
[Clang] Assert non-null enum definition in CGDebugInfo::CreateTypeDefinition(const EnumType*) (llvm#105556)
This commit adds an assert to check for a non-null enum definition in CGDebugInfo::CreateTypeDefinition(const EnumType*), ensuring precondition validity. Previous discussion on llvm#97105
1 parent 7186704 commit 8f08b75

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3561,6 +3561,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
35613561

35623562
SmallVector<llvm::Metadata *, 16> Enumerators;
35633563
ED = ED->getDefinition();
3564+
assert(ED && "An enumeration definition is required");
35643565
for (const auto *Enum : ED->enumerators()) {
35653566
Enumerators.push_back(
35663567
DBuilder.createEnumerator(Enum->getName(), Enum->getInitVal()));

0 commit comments

Comments
 (0)