llvm.org GIT mirror llvm / b339549
DebugInfo: make DW_TAG_atomic_type valid DW_TAG_atomic_type was already included in Dwarf.defs and emitted correctly, however Verifier didn't recognize it as valid. Thus we introduce the following changes: * Make DW_TAG_atomic_type valid tag for IR and DWARF (enabled only with -gdwarf-5) * Add it to related docs * Add DebugInfo tests Differential Revision: https://reviews.llvm.org/D26144 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285624 91177308-0d34-0410-b5e6-96231b3b80d8 Victor Leschuk 2 years ago
10 changed file(s) with 88 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
40774077 DW_TAG_friend = 42
40784078 DW_TAG_volatile_type = 53
40794079 DW_TAG_restrict_type = 55
4080 DW_TAG_atomic_type = 71
40804081
40814082 .. _DIDerivedTypeMember:
40824083
40934094 ``DW_TAG_typedef`` is used to provide a name for the ``baseType:``.
40944095
40954096 ``DW_TAG_pointer_type``, ``DW_TAG_reference_type``, ``DW_TAG_const_type``,
4096 ``DW_TAG_volatile_type`` and ``DW_TAG_restrict_type`` are used to qualify the
4097 ``baseType:``.
4097 ``DW_TAG_volatile_type``, ``DW_TAG_restrict_type`` and ``DW_TAG_atomic_type``
4098 are used to qualify the ``baseType:``.
40984099
40994100 Note that the ``void *`` type is expressed as a type derived from NULL.
41004101
12631263 * DW_TAG_packed_type
12641264 * DW_TAG_volatile_type
12651265 * DW_TAG_restrict_type
1266 * DW_TAG_atomic_type
12661267 * DW_TAG_interface_type
12671268 * DW_TAG_unspecified_type
12681269 * DW_TAG_shared_type
275275 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(MethodOptions)
276276
277277 /// Equivalent to CV_modifier_t.
278 /// TODO: Add flag for _Atomic modifier
278279 enum class ModifierOptions : uint16_t {
279280 None = 0x0000,
280281 Const = 0x0001,
10901090 return lowerTypeMemberPointer(cast(Ty));
10911091 case dwarf::DW_TAG_const_type:
10921092 case dwarf::DW_TAG_volatile_type:
1093 // TODO: add support for DW_TAG_atomic_type here
10931094 return lowerTypeModifier(cast(Ty));
10941095 case dwarf::DW_TAG_subroutine_type:
10951096 if (ClassTy) {
13981399 bool IsModifier = true;
13991400 const DIType *BaseTy = Ty;
14001401 while (IsModifier && BaseTy) {
1401 // FIXME: Need to add DWARF tag for __unaligned.
1402 // FIXME: Need to add DWARF tags for __unaligned and _Atomic
14021403 switch (BaseTy->getTag()) {
14031404 case dwarf::DW_TAG_const_type:
14041405 Mods |= ModifierOptions::Const;
9797
9898 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
9999 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
100 Tag != dwarf::DW_TAG_restrict_type)
100 Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_atomic_type)
101101 return DDTy->getSizeInBits();
102102
103103 DIType *BaseType = DDTy->getBaseType().resolve();
545545 return true;
546546 assert(T == dwarf::DW_TAG_typedef || T == dwarf::DW_TAG_const_type ||
547547 T == dwarf::DW_TAG_volatile_type ||
548 T == dwarf::DW_TAG_restrict_type);
548 T == dwarf::DW_TAG_restrict_type || T == dwarf::DW_TAG_atomic_type);
549549 DITypeRef Deriv = DTy->getBaseType();
550550 assert(Deriv && "Expected valid base type");
551551 return isUnsignedDIType(DD, DD->resolve(Deriv));
704704
705705 // DW_TAG_restrict_type is not supported in DWARF2
706706 if (Ty->getTag() == dwarf::DW_TAG_restrict_type && DD->getDwarfVersion() <= 2)
707 return getOrCreateTypeDIE(resolve(cast(Ty)->getBaseType()));
708
709 // DW_TAG_atomic_type is not supported in DWARF < 5
710 if (Ty->getTag() == dwarf::DW_TAG_atomic_type && DD->getDwarfVersion() < 5)
707711 return getOrCreateTypeDIE(resolve(cast(Ty)->getBaseType()));
708712
709713 // Construct the context before querying for the existence of the DIE in case
863863 N.getTag() == dwarf::DW_TAG_const_type ||
864864 N.getTag() == dwarf::DW_TAG_volatile_type ||
865865 N.getTag() == dwarf::DW_TAG_restrict_type ||
866 N.getTag() == dwarf::DW_TAG_atomic_type ||
866867 N.getTag() == dwarf::DW_TAG_member ||
867868 N.getTag() == dwarf::DW_TAG_inheritance ||
868869 N.getTag() == dwarf::DW_TAG_friend,
0 ; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
1 ; REQUIRES: object-emission
2
3 ; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source
4 ;
5 ; _Atomic const int i;
6 ;
7
8 ; CHECK: DW_TAG_variable
9 ; CHECK: DW_TAG_const_type
10 ; CHECK-NOT: DW_TAG_atomic_type
11 ; CHECK: DW_TAG_base_type
12
13 ; ModuleID = 'atomic.c'
14 source_filename = "atomic.c"
15 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
16 target triple = "x86_64-unknown-linux-gnu"
17
18 @i = common global i32 0, align 4, !dbg !0
19
20 !llvm.dbg.cu = !{!1}
21 !llvm.module.flags = !{!9, !10}
22 !llvm.ident = !{!11}
23
24 !0 = distinct !DIGlobalVariable(name: "i", scope: !1, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true)
25 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git cd238117e3a8a57271a82d0bb03d6df6ad8f073e) (http://llvm.org/git/llvm.git 9fd063832c1541aad3907cd60ac344d36997905f)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
26 !2 = !DIFile(filename: "atomic.c", directory: "/tmp")
27 !3 = !{}
28 !4 = !{!0}
29 !5 = !DIFile(filename: "atomic.c", directory: "/tmp")
30 !6 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !7)
31 !7 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !8)
32 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
33 !9 = !{i32 2, !"Dwarf Version", i32 4}
34 !10 = !{i32 2, !"Debug Info Version", i32 3}
35 !11 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git cd238117e3a8a57271a82d0bb03d6df6ad8f073e) (http://llvm.org/git/llvm.git 9fd063832c1541aad3907cd60ac344d36997905f)"}
0 ; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
1 ; REQUIRES: object-emission
2
3 ; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source
4 ;
5 ; _Atomic const int i;
6 ;
7
8 ; CHECK: DW_TAG_variable
9 ; CHECK: DW_TAG_const_type
10 ; CHECK: DW_TAG_atomic_type
11 ; CHECK-NOT: NULL
12 ; CHECK: DW_TAG_base_type
13
14 ; ModuleID = 'atomic.c'
15 source_filename = "atomic.c"
16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17 target triple = "x86_64-unknown-linux-gnu"
18
19 @i = common global i32 0, align 4, !dbg !0
20
21 !llvm.dbg.cu = !{!1}
22 !llvm.module.flags = !{!9, !10}
23 !llvm.ident = !{!11}
24
25 !0 = distinct !DIGlobalVariable(name: "i", scope: !1, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true)
26 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git cd238117e3a8a57271a82d0bb03d6df6ad8f073e) (http://llvm.org/git/llvm.git 9fd063832c1541aad3907cd60ac344d36997905f)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
27 !2 = !DIFile(filename: "atomic.c", directory: "/tmp")
28 !3 = !{}
29 !4 = !{!0}
30 !5 = !DIFile(filename: "atomic.c", directory: "/tmp")
31 !6 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !7)
32 !7 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !8)
33 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
34 !9 = !{i32 2, !"Dwarf Version", i32 5}
35 !10 = !{i32 2, !"Debug Info Version", i32 3}
36 !11 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git cd238117e3a8a57271a82d0bb03d6df6ad8f073e) (http://llvm.org/git/llvm.git 9fd063832c1541aad3907cd60ac344d36997905f)"}
26652665 case dwarf::DW_TAG_packed_type:
26662666 case dwarf::DW_TAG_volatile_type:
26672667 case dwarf::DW_TAG_restrict_type:
2668 case dwarf::DW_TAG_atomic_type:
26682669 case dwarf::DW_TAG_interface_type:
26692670 case dwarf::DW_TAG_unspecified_type:
26702671 case dwarf::DW_TAG_shared_type: