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

2024-08-23 Thread Tom Honermann via cfe-commits
@@ -98,3 +98,6 @@ enum E8 { A8 = -128, B8 = 127 } x8; // CHECK-NOT: DIFlagEnumClass // CHECK: !DIEnumerator(name: "A8", value: -128) +// Forward declaration of an enum class. +enum class Color : int; +// CHECK-NOT: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Color" -

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

2024-08-23 Thread via cfe-commits
smanna12 wrote: I am unable to add new change in this PR. Follow-up is here: https://github.com/llvm/llvm-project/pull/105556. https://github.com/llvm/llvm-project/pull/97105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

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

2024-08-23 Thread via cfe-commits
https://github.com/smanna12 closed https://github.com/llvm/llvm-project/pull/97105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-24 Thread Tom Honermann via cfe-commits
@@ -98,3 +98,6 @@ enum E8 { A8 = -128, B8 = 127 } x8; // CHECK-NOT: DIFlagEnumClass // CHECK: !DIEnumerator(name: "A8", value: -128) +// Forward declaration of an enum class. +enum class Color : int; +// CHECK-NOT: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Color" -

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

2024-07-24 Thread David Blaikie via cfe-commits
@@ -98,3 +98,6 @@ enum E8 { A8 = -128, B8 = 127 } x8; // CHECK-NOT: DIFlagEnumClass // CHECK: !DIEnumerator(name: "A8", value: -128) +// Forward declaration of an enum class. +enum class Color : int; +// CHECK-NOT: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Color" -

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

2024-07-23 Thread via cfe-commits
smanna12 wrote: > Thanks @smanna12. I think this looks ok; returning null here does appear to > be consistent with other overloads of `CreateTypeDefinition` for `RecordType` > and `ObjCInterfaceType`. I agree with @Michael137 that it would be nice to > have an example that fails the added cond

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

2024-07-23 Thread via cfe-commits
https://github.com/smanna12 updated https://github.com/llvm/llvm-project/pull/97105 >From 5a4f0207afa9a473ba8ebf1e24a75730cd13a553 Mon Sep 17 00:00:00 2001 From: "Manna, Soumi" Date: Fri, 28 Jun 2024 12:58:45 -0700 Subject: [PATCH 1/2] [Clang] Fix null pointer dereference in enum debug info ge

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

2024-07-16 Thread David Blaikie via cfe-commits
dwblaikie wrote: > Thanks @smanna12. I think this looks ok; returning null here does appear to > be consistent with other overloads of `CreateTypeDefinition` for `RecordType` > and `ObjCInterfaceType`. I agree with @Michael137 that it would be nice to > have an example that fails the added con

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

2024-07-16 Thread Tom Honermann via cfe-commits
https://github.com/tahonermann approved this pull request. Thanks @smanna12. I think this looks ok; returning null here does appear to be consistent with other overloads of `CreateTypeDefinition` for `RecordType` and `ObjCInterfaceType`. I agree with @Michael137 that it would be nice to have an

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

2024-06-29 Thread Michael Buch via cfe-commits
@@ -3518,6 +3518,10 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { SmallVector Enumerators; ED = ED->getDefinition(); + + if (!ED) +return nullptr; + Michael137 wrote: Do you have an example/reproducer where this would get

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

2024-06-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: None (smanna12) Changes This patch prevents dereferencing a null enum definition by returning `nullptr` if `getDefinition()` fails in `CreateTypeDefinition()`. --- Full diff: https://github.com/llvm/llvm

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

2024-06-28 Thread via cfe-commits
https://github.com/smanna12 created https://github.com/llvm/llvm-project/pull/97105 This patch prevents dereferencing a null enum definition by returning `nullptr` if `getDefinition()` fails in `CreateTypeDefinition()`. >From 5a4f0207afa9a473ba8ebf1e24a75730cd13a553 Mon Sep 17 00:00:00 2001 Fr