https://github.com/ykhatav updated https://github.com/llvm/llvm-project/pull/137682
>From 0647828990d9ec89554c016e4e016f28b9a2931d Mon Sep 17 00:00:00 2001 From: "Khatavkar, Yashasvi" <yashasvi.khatav...@intel.com> Date: Mon, 28 Apr 2025 10:53:53 -0700 Subject: [PATCH 1/4] Retain unused nested enum type information --- clang/lib/CodeGen/CGDebugInfo.cpp | 9 ++ clang/lib/CodeGen/CGDebugInfo.h | 1 + llvm/test/DebugInfo/X86/nested_unused_enum.ll | 104 ++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 llvm/test/DebugInfo/X86/nested_unused_enum.ll diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index f3ec498d4064b..6bac549b2a8f1 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1901,6 +1901,13 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy, return GV; } +void CGDebugInfo::CollectRecordEnumType(const EnumDecl *ED, SmallVectorImpl<llvm::Metadata *> &elements) { +QualType Ty = CGM.getContext().getTypeDeclType(ED); + SourceLocation Loc = ED->getLocation(); + if (llvm::DIType *enumType = getOrCreateType(Ty, getOrCreateFile(Loc))) + elements.push_back(enumType); +} + void CGDebugInfo::CollectRecordNormalField( const FieldDecl *field, uint64_t OffsetInBits, llvm::DIFile *tunit, SmallVectorImpl<llvm::Metadata *> &elements, llvm::DIType *RecordTy, @@ -1987,6 +1994,8 @@ void CGDebugInfo::CollectRecordFields( // Bump field number for next field. ++fieldNo; + } else if (const auto *enumType = dyn_cast<EnumDecl>(I)) { + CollectRecordEnumType(enumType, elements); } else if (CGM.getCodeGenOpts().EmitCodeView) { // Debug info for nested types is included in the member list only for // CodeView. diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index b287ce7b92eee..2bfa66ddec509 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -370,6 +370,7 @@ class CGDebugInfo { llvm::DIDerivedType *CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy, const RecordDecl *RD); + void CollectRecordEnumType(const EnumDecl *ED, SmallVectorImpl<llvm::Metadata *> &elements); void CollectRecordNormalField(const FieldDecl *Field, uint64_t OffsetInBits, llvm::DIFile *F, SmallVectorImpl<llvm::Metadata *> &E, diff --git a/llvm/test/DebugInfo/X86/nested_unused_enum.ll b/llvm/test/DebugInfo/X86/nested_unused_enum.ll new file mode 100644 index 0000000000000..f8f304add2eb8 --- /dev/null +++ b/llvm/test/DebugInfo/X86/nested_unused_enum.ll @@ -0,0 +1,104 @@ +; RUN: %clang_cc1 -fno-eliminate-unused-debug-types -emit-llvm -o - %s | FileCheck %s +; RUN: llvm-dwarfdump %t | FileCheck %s + +;CHECK: DW_TAG_structure_type +;CHECK-NEXT: DW_AT_calling_convention (DW_CC_pass_by_value) +;CHECK-NEXT: DW_AT_name ("Type") +;CHECK-NEXT: DW_AT_byte_size (0x04) +;CHECK-NEXT: DW_AT_decl_file ("/iusers/ykhatavk/project_ics/llvm-project/debug_issue/enump.cpp") +;CHECK-NEXT: DW_AT_decl_line (1) +;CHECK: DW_TAG_member +;CHECK-NEXT: DW_AT_name ("value") +;CHECK-NEXT: DW_AT_type (0x0000004f "int") +;CHECK-NEXT: DW_AT_decl_file ("/iusers/ykhatavk/project_ics/llvm-project/debug_issue/enump.cpp") +;CHECK-NEXT: DW_AT_decl_line (3) +;CHECK-NEXT: DW_AT_data_member_location (0x00) +;CHECK: DW_TAG_enumeration_type +;CHECK-NEXT: DW_AT_type (0x00000053 "unsigned int") +;CHECK-NEXT: DW_AT_byte_size (0x04) +;CHECK-NEXT: DW_AT_decl_file ("/iusers/ykhatavk/project_ics/llvm-project/debug_issue/enump.cpp") +;CHECK-NEXT: DW_AT_decl_line (2) +;CHECK: DW_TAG_enumerator +;CHECK-NEXT: DW_AT_name ("Unused") +;CHECK-NEXT: DW_AT_const_value (0) + +; ModuleID = 'enump.cpp' +source_filename = "enump.cpp" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +%struct.Type = type { i32 } + +$_ZN4TypeC2Ev = comdat any + +; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable +define dso_local noundef i32 @main() #0 !dbg !20 { +entry: + %retval = alloca i32, align 4 + %t = alloca %struct.Type, align 4 + store i32 0, ptr %retval, align 4 + #dbg_declare(ptr %t, !24, !DIExpression(), !25) + call void @_ZN4TypeC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %t) #2, !dbg !25 + %value = getelementptr inbounds nuw %struct.Type, ptr %t, i32 0, i32 0, !dbg !26 + %0 = load i32, ptr %value, align 4, !dbg !26 + ret i32 %0, !dbg !27 +} + +; Function Attrs: mustprogress noinline nounwind optnone uwtable +define linkonce_odr dso_local void @_ZN4TypeC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %this) unnamed_addr #1 comdat align 2 !dbg !28 { +entry: + %this.addr = alloca ptr, align 8 + store ptr %this, ptr %this.addr, align 8 + #dbg_declare(ptr %this.addr, !33, !DIExpression(), !35) + %this1 = load ptr, ptr %this.addr, align 8 + %value = getelementptr inbounds nuw %struct.Type, ptr %this1, i32 0, i32 0, !dbg !36 + store i32 0, ptr %value, align 4, !dbg !36 + ret void, !dbg !37 +} + +attributes #0 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #1 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #2 = { nounwind } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!12, !13, !14, !15, !16, !17, !18} +!llvm.ident = !{!19} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 21.0.0git (https://github.com/llvm/llvm-project.git 2b983a24583dd4e131d727717872a56712b5dd52)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !11, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "enump.cpp", directory: "/iusers/ykhatavk/project_ics/llvm-project/debug_issue", checksumkind: CSK_MD5, checksum: "35ec0482db78c9e464e8bf8cd231d5b9") +!2 = !{!3} +!3 = !DICompositeType(tag: DW_TAG_enumeration_type, scope: !4, file: !1, line: 2, baseType: !8, size: 32, elements: !9, identifier: "_ZTSN4TypeUt_E") +!4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Type", file: !1, line: 1, size: 32, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !5, identifier: "_ZTS4Type") +!5 = !{!3, !6} +!6 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !4, file: !1, line: 3, baseType: !7, size: 32) +!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!8 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) +!9 = !{!10} +!10 = !DIEnumerator(name: "Unused", value: 0, isUnsigned: true) +!11 = !{!4} +!12 = !{i32 7, !"Dwarf Version", i32 5} +!13 = !{i32 2, !"Debug Info Version", i32 3} +!14 = !{i32 1, !"wchar_size", i32 4} +!15 = !{i32 8, !"PIC Level", i32 2} +!16 = !{i32 7, !"PIE Level", i32 2} +!17 = !{i32 7, !"uwtable", i32 2} +!18 = !{i32 7, !"frame-pointer", i32 2} +!19 = !{!"clang version 21.0.0git (https://github.com/llvm/llvm-project.git 2b983a24583dd4e131d727717872a56712b5dd52)"} +!20 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 5, type: !21, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !23) +!21 = !DISubroutineType(types: !22) +!22 = !{!7} +!23 = !{} +!24 = !DILocalVariable(name: "t", scope: !20, file: !1, line: 6, type: !4) +!25 = !DILocation(line: 6, column: 10, scope: !20) +!26 = !DILocation(line: 7, column: 14, scope: !20) +!27 = !DILocation(line: 7, column: 5, scope: !20) +!28 = distinct !DISubprogram(name: "Type", linkageName: "_ZN4TypeC2Ev", scope: !4, file: !1, line: 1, type: !29, scopeLine: 1, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !32, retainedNodes: !23) +!29 = !DISubroutineType(types: !30) +!30 = !{null, !31} +!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) +!32 = !DISubprogram(name: "Type", scope: !4, type: !29, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: 0) +!33 = !DILocalVariable(name: "this", arg: 1, scope: !28, type: !34, flags: DIFlagArtificial | DIFlagObjectPointer) +!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64) +!35 = !DILocation(line: 0, scope: !28) +!36 = !DILocation(line: 3, column: 9, scope: !28) +!37 = !DILocation(line: 1, column: 8, scope: !28) >From c14676ece567a0062b6a9e8c2f97cc117220b4b1 Mon Sep 17 00:00:00 2001 From: "Khatavkar, Yashasvi" <yashasvi.khatav...@intel.com> Date: Mon, 28 Apr 2025 11:19:38 -0700 Subject: [PATCH 2/4] apply clang-format --- clang/lib/CodeGen/CGDebugInfo.cpp | 9 +++++---- clang/lib/CodeGen/CGDebugInfo.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 6bac549b2a8f1..7840b09776be4 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1901,8 +1901,9 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy, return GV; } -void CGDebugInfo::CollectRecordEnumType(const EnumDecl *ED, SmallVectorImpl<llvm::Metadata *> &elements) { -QualType Ty = CGM.getContext().getTypeDeclType(ED); +void CGDebugInfo::CollectRecordEnumType( + const EnumDecl *ED, SmallVectorImpl<llvm::Metadata *> &elements) { + QualType Ty = CGM.getContext().getTypeDeclType(ED); SourceLocation Loc = ED->getLocation(); if (llvm::DIType *enumType = getOrCreateType(Ty, getOrCreateFile(Loc))) elements.push_back(enumType); @@ -1994,8 +1995,8 @@ void CGDebugInfo::CollectRecordFields( // Bump field number for next field. ++fieldNo; - } else if (const auto *enumType = dyn_cast<EnumDecl>(I)) { - CollectRecordEnumType(enumType, elements); + } else if (const auto *enumType = dyn_cast<EnumDecl>(I)) { + CollectRecordEnumType(enumType, elements); } else if (CGM.getCodeGenOpts().EmitCodeView) { // Debug info for nested types is included in the member list only for // CodeView. diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 2bfa66ddec509..baf2069745535 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -370,7 +370,8 @@ class CGDebugInfo { llvm::DIDerivedType *CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy, const RecordDecl *RD); - void CollectRecordEnumType(const EnumDecl *ED, SmallVectorImpl<llvm::Metadata *> &elements); + void CollectRecordEnumType(const EnumDecl *ED, + SmallVectorImpl<llvm::Metadata *> &elements); void CollectRecordNormalField(const FieldDecl *Field, uint64_t OffsetInBits, llvm::DIFile *F, SmallVectorImpl<llvm::Metadata *> &E, >From 5ea124927554bb4e6ed5cb5649075ff0024b11ab Mon Sep 17 00:00:00 2001 From: "Khatavkar, Yashasvi" <yashasvi.khatav...@intel.com> Date: Mon, 28 Apr 2025 11:22:58 -0700 Subject: [PATCH 3/4] Add clang test --- clang/test/CodeGen/unused_nested_enump.cpp | 32 ++++++ llvm/test/DebugInfo/X86/nested_unused_enum.ll | 104 ------------------ 2 files changed, 32 insertions(+), 104 deletions(-) create mode 100644 clang/test/CodeGen/unused_nested_enump.cpp delete mode 100644 llvm/test/DebugInfo/X86/nested_unused_enum.ll diff --git a/clang/test/CodeGen/unused_nested_enump.cpp b/clang/test/CodeGen/unused_nested_enump.cpp new file mode 100644 index 0000000000000..b4bab645ad0e5 --- /dev/null +++ b/clang/test/CodeGen/unused_nested_enump.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -debug-info-kind=unused-types -emit-llvm -o - %s | FileCheck %s + +struct Type { + enum { Unused }; + int value = 0; +}; +int main() { + Type t; + return t.value; +} + +// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type +// CHECK-SAME: scope: ![[STRUCT:[0-9]+]] +// CHECK-SAME: baseType: ![[UINT:[0-9]+]] +// CHECK-SAME: elements: ![[ELEMENTS:[0-9]+]] + +// CHECK: ![[STRUCT]] = distinct !DICompositeType(tag: DW_TAG_structure_type +// CHECK-SAME: elements: ![[STRUCT_ELEMENTS:[0-9]+]] + +// CHECK: ![[STRUCT_ELEMENTS]] = !{![[ENUM_MEMBER:[0-9]+]], ![[VALUE_MEMBER:[0-9]+]]} + +// CHECK: ![[VALUE_MEMBER]] = !DIDerivedType(tag: DW_TAG_member +// CHECK-SAME: name: "value" +// CHECK-SAME: scope: ![[STRUCT]] +// CHECK-SAME: baseType: ![[INT:[0-9]+]] + +// CHECK: ![[INT]] = !DIBasicType(name: "int" + +// CHECK: ![[UINT]] = !DIBasicType(name: "unsigned int" + +// CHECK: ![[ELEMENTS]] = !{![[ENUMERATOR:[0-9]+]]} +// CHECK: ![[ENUMERATOR]] = !DIEnumerator(name: "Unused", value: 0, isUnsigned: true) diff --git a/llvm/test/DebugInfo/X86/nested_unused_enum.ll b/llvm/test/DebugInfo/X86/nested_unused_enum.ll deleted file mode 100644 index f8f304add2eb8..0000000000000 --- a/llvm/test/DebugInfo/X86/nested_unused_enum.ll +++ /dev/null @@ -1,104 +0,0 @@ -; RUN: %clang_cc1 -fno-eliminate-unused-debug-types -emit-llvm -o - %s | FileCheck %s -; RUN: llvm-dwarfdump %t | FileCheck %s - -;CHECK: DW_TAG_structure_type -;CHECK-NEXT: DW_AT_calling_convention (DW_CC_pass_by_value) -;CHECK-NEXT: DW_AT_name ("Type") -;CHECK-NEXT: DW_AT_byte_size (0x04) -;CHECK-NEXT: DW_AT_decl_file ("/iusers/ykhatavk/project_ics/llvm-project/debug_issue/enump.cpp") -;CHECK-NEXT: DW_AT_decl_line (1) -;CHECK: DW_TAG_member -;CHECK-NEXT: DW_AT_name ("value") -;CHECK-NEXT: DW_AT_type (0x0000004f "int") -;CHECK-NEXT: DW_AT_decl_file ("/iusers/ykhatavk/project_ics/llvm-project/debug_issue/enump.cpp") -;CHECK-NEXT: DW_AT_decl_line (3) -;CHECK-NEXT: DW_AT_data_member_location (0x00) -;CHECK: DW_TAG_enumeration_type -;CHECK-NEXT: DW_AT_type (0x00000053 "unsigned int") -;CHECK-NEXT: DW_AT_byte_size (0x04) -;CHECK-NEXT: DW_AT_decl_file ("/iusers/ykhatavk/project_ics/llvm-project/debug_issue/enump.cpp") -;CHECK-NEXT: DW_AT_decl_line (2) -;CHECK: DW_TAG_enumerator -;CHECK-NEXT: DW_AT_name ("Unused") -;CHECK-NEXT: DW_AT_const_value (0) - -; ModuleID = 'enump.cpp' -source_filename = "enump.cpp" -target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -%struct.Type = type { i32 } - -$_ZN4TypeC2Ev = comdat any - -; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable -define dso_local noundef i32 @main() #0 !dbg !20 { -entry: - %retval = alloca i32, align 4 - %t = alloca %struct.Type, align 4 - store i32 0, ptr %retval, align 4 - #dbg_declare(ptr %t, !24, !DIExpression(), !25) - call void @_ZN4TypeC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %t) #2, !dbg !25 - %value = getelementptr inbounds nuw %struct.Type, ptr %t, i32 0, i32 0, !dbg !26 - %0 = load i32, ptr %value, align 4, !dbg !26 - ret i32 %0, !dbg !27 -} - -; Function Attrs: mustprogress noinline nounwind optnone uwtable -define linkonce_odr dso_local void @_ZN4TypeC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %this) unnamed_addr #1 comdat align 2 !dbg !28 { -entry: - %this.addr = alloca ptr, align 8 - store ptr %this, ptr %this.addr, align 8 - #dbg_declare(ptr %this.addr, !33, !DIExpression(), !35) - %this1 = load ptr, ptr %this.addr, align 8 - %value = getelementptr inbounds nuw %struct.Type, ptr %this1, i32 0, i32 0, !dbg !36 - store i32 0, ptr %value, align 4, !dbg !36 - ret void, !dbg !37 -} - -attributes #0 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -attributes #1 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -attributes #2 = { nounwind } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!12, !13, !14, !15, !16, !17, !18} -!llvm.ident = !{!19} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 21.0.0git (https://github.com/llvm/llvm-project.git 2b983a24583dd4e131d727717872a56712b5dd52)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !11, splitDebugInlining: false, nameTableKind: None) -!1 = !DIFile(filename: "enump.cpp", directory: "/iusers/ykhatavk/project_ics/llvm-project/debug_issue", checksumkind: CSK_MD5, checksum: "35ec0482db78c9e464e8bf8cd231d5b9") -!2 = !{!3} -!3 = !DICompositeType(tag: DW_TAG_enumeration_type, scope: !4, file: !1, line: 2, baseType: !8, size: 32, elements: !9, identifier: "_ZTSN4TypeUt_E") -!4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Type", file: !1, line: 1, size: 32, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !5, identifier: "_ZTS4Type") -!5 = !{!3, !6} -!6 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !4, file: !1, line: 3, baseType: !7, size: 32) -!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!8 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) -!9 = !{!10} -!10 = !DIEnumerator(name: "Unused", value: 0, isUnsigned: true) -!11 = !{!4} -!12 = !{i32 7, !"Dwarf Version", i32 5} -!13 = !{i32 2, !"Debug Info Version", i32 3} -!14 = !{i32 1, !"wchar_size", i32 4} -!15 = !{i32 8, !"PIC Level", i32 2} -!16 = !{i32 7, !"PIE Level", i32 2} -!17 = !{i32 7, !"uwtable", i32 2} -!18 = !{i32 7, !"frame-pointer", i32 2} -!19 = !{!"clang version 21.0.0git (https://github.com/llvm/llvm-project.git 2b983a24583dd4e131d727717872a56712b5dd52)"} -!20 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 5, type: !21, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !23) -!21 = !DISubroutineType(types: !22) -!22 = !{!7} -!23 = !{} -!24 = !DILocalVariable(name: "t", scope: !20, file: !1, line: 6, type: !4) -!25 = !DILocation(line: 6, column: 10, scope: !20) -!26 = !DILocation(line: 7, column: 14, scope: !20) -!27 = !DILocation(line: 7, column: 5, scope: !20) -!28 = distinct !DISubprogram(name: "Type", linkageName: "_ZN4TypeC2Ev", scope: !4, file: !1, line: 1, type: !29, scopeLine: 1, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !32, retainedNodes: !23) -!29 = !DISubroutineType(types: !30) -!30 = !{null, !31} -!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) -!32 = !DISubprogram(name: "Type", scope: !4, type: !29, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: 0) -!33 = !DILocalVariable(name: "this", arg: 1, scope: !28, type: !34, flags: DIFlagArtificial | DIFlagObjectPointer) -!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64) -!35 = !DILocation(line: 0, scope: !28) -!36 = !DILocation(line: 3, column: 9, scope: !28) -!37 = !DILocation(line: 1, column: 8, scope: !28) >From cc57ed64c90e678c9e2dc3ca576778fb14f8e700 Mon Sep 17 00:00:00 2001 From: "Khatavkar, Yashasvi" <yashasvi.khatav...@intel.com> Date: Mon, 28 Apr 2025 13:39:57 -0700 Subject: [PATCH 4/4] remove unnecessary checks --- clang/test/CodeGen/unused_nested_enump.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/clang/test/CodeGen/unused_nested_enump.cpp b/clang/test/CodeGen/unused_nested_enump.cpp index b4bab645ad0e5..2d394bc21e644 100644 --- a/clang/test/CodeGen/unused_nested_enump.cpp +++ b/clang/test/CodeGen/unused_nested_enump.cpp @@ -11,7 +11,6 @@ int main() { // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type // CHECK-SAME: scope: ![[STRUCT:[0-9]+]] -// CHECK-SAME: baseType: ![[UINT:[0-9]+]] // CHECK-SAME: elements: ![[ELEMENTS:[0-9]+]] // CHECK: ![[STRUCT]] = distinct !DICompositeType(tag: DW_TAG_structure_type @@ -22,11 +21,6 @@ int main() { // CHECK: ![[VALUE_MEMBER]] = !DIDerivedType(tag: DW_TAG_member // CHECK-SAME: name: "value" // CHECK-SAME: scope: ![[STRUCT]] -// CHECK-SAME: baseType: ![[INT:[0-9]+]] - -// CHECK: ![[INT]] = !DIBasicType(name: "int" - -// CHECK: ![[UINT]] = !DIBasicType(name: "unsigned int" // CHECK: ![[ELEMENTS]] = !{![[ENUMERATOR:[0-9]+]]} // CHECK: ![[ENUMERATOR]] = !DIEnumerator(name: "Unused", value: 0, isUnsigned: true) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits