Skip to content

Commit

Permalink
[Clang] Assert non-null enum definition in CGDebugInfo::CreateTypeDef…
Browse files Browse the repository at this point in the history
…inition(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
  • Loading branch information
smanna12 authored Aug 23, 2024
1 parent 7186704 commit 8f08b75
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3561,6 +3561,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {

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

0 comments on commit 8f08b75

Please sign in to comment.