[clang] [Clang] Fix null pointer dereference in enum debug info generation (PR #105556)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 10:28:13 PDT 2024


https://github.com/smanna12 created https://github.com/llvm/llvm-project/pull/105556

None

>From 3ea17898c7281195fc3def45485cc3528c743ded Mon Sep 17 00:00:00 2001
From: "Manna, Soumi" <soumi.manna at intel.com>
Date: Wed, 21 Aug 2024 10:26:42 -0700
Subject: [PATCH] [Clang] Fix null pointer dereference in enum debug info
 generation

---
 clang/lib/CodeGen/CGDebugInfo.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 7ad3088f0ab756..dc83d596e3cb06 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()));



More information about the cfe-commits mailing list