| ! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s | |
| ! RUN: %flang_fc1 -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck --check-prefix=LINEONLY %s | |
| ! RUN: %flang_fc1 -emit-llvm -debug-info-kind=line-directives-only %s -o - | FileCheck --check-prefix=LINEONLY %s | |
| ! More than one DIFile can name this source, so take the one the module is | |
| ! described in from the module itself rather than trying to tell them apart by | |
| ! how each spells the path. | |
| ! CHECK-DAG: ![[CU:.*]] = distinct !DICompileUnit({{.*}}globals: ![[GLOBALS:.*]]) | |
| ! CHECK-DAG: ![[MOD:.*]] = !DIModule(scope: ![[CU]], name: "helper", file: ![[FILE:[0-9]+]]{{.*}}) | |
| ! CHECK-DAG: ![[FILE]] = !DIFile(filename: "debug-module-2.f90"{{.*}}) | |
| ! CHECK-DAG: ![[R4:.*]] = !DIBasicType(name: "real(kind=4)", size: 32, encoding: DW_ATE_float) | |
| ! CHECK-DAG: ![[I4:.*]] = !DIBasicType(name: "integer(kind=4)", size: 32, encoding: DW_ATE_signed) | |
| module helper | |
| ! CHECK-DAG: ![[GLR:.*]] = distinct !DIGlobalVariable(name: "glr", linkageName: "_QMhelperEglr", scope: ![[MOD]], file: ![[FILE]], line: [[@LINE+2]], type: ![[R4]], isLocal: false, isDefinition: true) | |
| ! CHECK-DAG: ![[GLRX:.*]] = !DIGlobalVariableExpression(var: ![[GLR]], expr: !DIExpression()) | |
| real glr | |
| ! CHECK-DAG: ![[GLI:.*]] = distinct !DIGlobalVariable(name: "gli", linkageName: "_QMhelperEgli", scope: ![[MOD]], file: ![[FILE]], line: [[@LINE+2]], type: ![[I4]], isLocal: false, isDefinition: true) | |
| ! CHECK-DAG: ![[GLIX:.*]] = !DIGlobalVariableExpression(var: ![[GLI]], expr: !DIExpression()) | |
| integer gli | |
| contains | |
| !CHECK-DAG: !DISubprogram(name: "test", linkageName: "_QMhelperPtest", scope: ![[MOD]], file: ![[FILE]], line: [[@LINE+1]]{{.*}}unit: ![[CU]]{{.*}}) | |
| subroutine test() | |
| glr = 12.34 | |
| gli = 67 | |
| end subroutine | |
| end module helper | |
| program test | |
| use helper | |
| implicit none | |
| glr = 3.14 | |
| gli = 2 | |
| call test() | |
| end program test | |
| ! CHECK-DAG: ![[GLOBALS]] = !{![[GLIX]], ![[GLRX]]} | |
| ! LINEONLY-NOT: DIGlobalVariable |