56 lines · plain
1; RUN: not opt -S < %s 2>&1 | FileCheck %s2 3;; Test that extraData with MDTuple is only allowed for specific DWARF tags:4;; DW_TAG_inheritance, DW_TAG_member, and DW_TAG_variable5 6!llvm.module.flags = !{!0}7!0 = !{i32 2, !"Debug Info Version", i32 3}8 9!1 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)10 11; Keep all metadata nodes alive so verifier can check them12!named = !{!1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16}13!2 = !{i32 0}14 15; Valid: DW_TAG_inheritance with tuple extraData should be accepted16!3 = !DIDerivedType(tag: DW_TAG_inheritance, baseType: !1, size: 32, extraData: !2)17 18; Valid: DW_TAG_member with tuple extraData should be accepted19!4 = !DIDerivedType(tag: DW_TAG_member, name: "field", baseType: !1, size: 32, extraData: !2)20 21; Valid: DW_TAG_variable (static member) with tuple extraData should be accepted22!5 = !DIDerivedType(tag: DW_TAG_variable, name: "var", baseType: !1, extraData: !2, flags: DIFlagStaticMember)23 24; Invalid: Empty tuple should be rejected25!6 = !{}26; CHECK: extraData must be ConstantAsMetadata, MDString, DIObjCProperty, or MDTuple with single ConstantAsMetadata operand27; CHECK-NEXT: !{{[0-9]+}} = !DIDerivedType(tag: DW_TAG_member28!7 = !DIDerivedType(tag: DW_TAG_member, name: "field2", baseType: !1, extraData: !6)29 30; Invalid: Tuple with multiple operands should be rejected31!8 = !{i32 0, i32 1}32; CHECK: extraData must be ConstantAsMetadata, MDString, DIObjCProperty, or MDTuple with single ConstantAsMetadata operand33; CHECK-NEXT: !{{[0-9]+}} = !DIDerivedType(tag: DW_TAG_member34!9 = !DIDerivedType(tag: DW_TAG_member, name: "field3", baseType: !1, extraData: !8)35 36; Invalid: Tuple with non-ConstantAsMetadata operand should be rejected37!10 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)38!11 = !{!10}39; CHECK: extraData must be ConstantAsMetadata, MDString, DIObjCProperty, or MDTuple with single ConstantAsMetadata operand40; CHECK-NEXT: !{{[0-9]+}} = !DIDerivedType(tag: DW_TAG_member41!12 = !DIDerivedType(tag: DW_TAG_member, name: "field4", baseType: !1, extraData: !11)42 43; Valid: DW_TAG_template_alias with proper template parameters tuple44; Template aliases are handled specially and accept any MDTuple for template parameters45!13 = !DITemplateTypeParameter(name: "T", type: !1)46!14 = !{!13}47!15 = !DIDerivedType(tag: DW_TAG_template_alias, name: "MyAlias", baseType: !1, extraData: !14)48 49; Invalid: DW_TAG_template_alias with non-tuple extraData should fail50; CHECK: invalid template parameters51; CHECK-NEXT: !{{[0-9]+}} = !DIDerivedType(tag: DW_TAG_template_alias52!16 = !DIDerivedType(tag: DW_TAG_template_alias, name: "FailingAlias", baseType: !1, extraData: i32 42)53 54; CHECK: warning: ignoring invalid debug info55 56