1; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s 2 3; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source 4; 5; // every object of type struct data will be aligned to 128-byte boundary 6; struct data { 7; char x; 8; _Alignas(128) char arr[2]; 9; }; 10; 11; _Alignas(2048) struct data d; // this instance of data is aligned even stricter 12; int foo(void) 13; { 14; struct data local_data; 15; return 0; 16; } 17 18; CHECK: DW_TAG_variable 19; CHECK-NOT: DW_TAG 20; CHECK: DW_AT_name{{.*}}"d" 21; CHECK-NOT: DW_TAG 22; CHECK: DW_AT_alignment{{.*}}2048 23; CHECK: DW_TAG_structure_type 24; CHECK: DW_TAG_member 25; CHECK: DW_TAG_member 26; CHECK-NOT: DW_TAG 27; CHECK: DW_AT_name{{.*}}"arr" 28; CHECK-NOT: DW_TAG 29; CHECK: DW_AT_alignment{{.*}}128 30 31; ModuleID = 'test.c' 32source_filename = "test.c" 33target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 34target triple = "x86_64-unknown-linux-gnu" 35 36%struct.data = type { i8, [127 x i8], [2 x i8], [126 x i8] } 37 38@d = common global %struct.data zeroinitializer, align 2048, !dbg !0 39 40; Function Attrs: nounwind uwtable 41define i32 @foo() #0 !dbg !17 { 42entry: 43 %local_data = alloca %struct.data, align 128 44 call void @llvm.dbg.declare(metadata %struct.data* %local_data, metadata !21, metadata !22), !dbg !23 45 ret i32 0, !dbg !24 46} 47 48; Function Attrs: nounwind readnone 49declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 50 51attributes #0 = { nounwind uwtable } 52attributes #1 = { nounwind readnone } 53 54!llvm.dbg.cu = !{!2} 55!llvm.module.flags = !{!14, !15} 56!llvm.ident = !{!16} 57 58!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 59!1 = !DIGlobalVariable(name: "d", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, align: 16384) 60!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 4.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 61!3 = !DIFile(filename: "test.c", directory: "/tmp") 62!4 = !{} 63!5 = !{!0} 64!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "data", file: !3, line: 2, size: 2048, elements: !7) 65!7 = !{!8, !10} 66!8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !3, line: 3, baseType: !9, size: 8) 67!9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 68!10 = !DIDerivedType(tag: DW_TAG_member, name: "arr", scope: !6, file: !3, line: 4, baseType: !11, size: 16, align: 1024, offset: 1024) 69!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 16, elements: !12) 70!12 = !{!13} 71!13 = !DISubrange(count: 2) 72!14 = !{i32 2, !"Dwarf Version", i32 4} 73!15 = !{i32 2, !"Debug Info Version", i32 3} 74!16 = !{!"clang version 4.0.0"} 75!17 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 8, type: !18, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4) 76!18 = !DISubroutineType(types: !19) 77!19 = !{!20} 78!20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 79!21 = !DILocalVariable(name: "local_data", scope: !17, file: !3, line: 10, type: !6) 80!22 = !DIExpression() 81!23 = !DILocation(line: 10, column: 17, scope: !17) 82!24 = !DILocation(line: 11, column: 5, scope: !17) 83 84