xref: /llvm-project/llvm/test/DebugInfo/fortran-string-type.ll (revision 28bfa57a7315c3161124c90b4d52f467616dc92e)
1;; Test for !DIStringType. This DI is used to construct a Fortran CHARACTER
2;; intrinsic type, either with a compile-time constant LEN type parameter or
3;; when LEN is a dynamic parameter as in a deferred-length CHARACTER.  (See
4;; section 7.4.4 of the Fortran 2018 standard.)
5
6; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
7; CHECK: !DIStringType(name: "character(*)", stringLength: !{{[0-9]+}}, stringLengthExpression: !DIExpression(), size: 32)
8; CHECK: !DIStringType(name: "character(10)", size: 80, align: 8)
9; CHECK: !DIBasicType(tag: DW_TAG_string_type
10; CHECK: !DIStringType(name: ".str.DEFERRED", stringLengthExpression: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 8), stringLocationExpression: !DIExpression(DW_OP_push_object_address, DW_OP_deref))
11
12!llvm.module.flags = !{!0, !1}
13!llvm.dbg.cu = !{!2}
14
15!0 = !{i32 2, !"Dwarf Version", i32 4}
16!1 = !{i32 1, !"Debug Info Version", i32 3}
17!2 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: "Flang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !4, imports: !4)
18!3 = !DIFile(filename: "fortran-string-type.f", directory: "/")
19!4 = !{}
20!5 = !{!6, !9, !12, !13, !14}
21!6 = !DIStringType(name: "character(*)", stringLength: !7, stringLengthExpression: !DIExpression(), size: 32)
22!7 = !DILocalVariable(arg: 2, scope: !8, file: !3, line: 256, type: !11, flags: DIFlagArtificial)
23!8 = distinct !DISubprogram(name: "subprgm", scope: !2, file: !3, line: 256, type: !9, isLocal: false, isDefinition: true, scopeLine: 256, isOptimized: false, unit: !2)
24!9 = !DISubroutineType(types: !10)
25!10 = !{null, !6, !11}
26!11 = !DIBasicType(name: "integer*8", size: 64, align: 64, encoding: DW_ATE_signed)
27!12 = !DIStringType(name: "character(10)", size: 80, align: 8)
28!13 = !DIBasicType(tag: DW_TAG_string_type, name: "character")
29!14 = !DIStringType(name: ".str.DEFERRED", stringLengthExpression: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 8), stringLocationExpression: !DIExpression(DW_OP_push_object_address, DW_OP_deref))
30