diff options
author | smanna12 <soumi.manna@intel.com> | 2024-08-23 11:23:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 13:23:25 -0500 |
commit | 8f08b75ce4af9dc72fb560033db14891ac01a682 (patch) | |
tree | ce0881c5b3fc06e90f657efd193406fb1d538005 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 71867042041ebb02c2865ed7c9b908e691b31a91 (diff) | |
download | llvm-8f08b75ce4af9dc72fb560033db14891ac01a682.zip llvm-8f08b75ce4af9dc72fb560033db14891ac01a682.tar.gz llvm-8f08b75ce4af9dc72fb560033db14891ac01a682.tar.bz2 |
[Clang] Assert non-null enum definition in CGDebugInfo::CreateTypeDefinition(const EnumType*) (#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 https://github.com/llvm/llvm-project/pull/97105
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 7ad3088..dc83d59 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -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())); |