1; Test to ensure that a module containing both a NoDebug CU and one with 2; debug is handled correctly. 3 4; LLVM IR was generated the following way: 5; $ cat a.cpp 6; void f1(); 7; __attribute__((always_inline)) void f2() { 8; f1(); 9; } 10; void f3(); 11; void f4() { 12; f3(); 13; } 14; $ cat b.cpp 15; void f2(); 16; __attribute__((always_inline)) void f3() { 17; f2(); 18; } 19; $ clang++ -flto a.cpp -g -c 20; $ clang++ -flto b.cpp -Rpass=inline -c 21; $ llvm-link {a,b}.o -o - | opt -O2 - -o ab.bc 22; $ llvm-dis ab.bc 23 24; Ensure we can successfully generate assembly, and check that neither 25; "b.cpp" nor "f3" strings show up (which would be in the .debug_str 26; section if we had generated any lexical scopes and debug for them). 27; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -o - | FileCheck %s 28; CHECK-NOT: .asciz "b.cpp" 29; CHECK-NOT: .asciz "f3" 30 31; ModuleID = 'debug_and_nodebug_CUs.bc' 32source_filename = "debug_and_nodebug_CUs.ll" 33target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 34target triple = "x86_64-unknown-linux-gnu" 35 36define void @_Z2f2v() local_unnamed_addr !dbg !8 { 37entry: 38 tail call void @_Z2f1v(), !dbg !11 39 ret void, !dbg !12 40} 41 42declare void @_Z2f1v() local_unnamed_addr 43 44define void @_Z2f4v() local_unnamed_addr !dbg !13 { 45entry: 46 tail call void @_Z2f1v(), !dbg !14 47 ret void, !dbg !19 48} 49 50define void @_Z2f3v() local_unnamed_addr !dbg !16 { 51entry: 52 tail call void @_Z2f1v(), !dbg !20 53 ret void, !dbg !22 54} 55 56!llvm.dbg.cu = !{!0, !3} 57!llvm.ident = !{!5, !5} 58!llvm.module.flags = !{!6, !7} 59 60!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 294362) (llvm/trunk 294367)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 61!1 = !DIFile(filename: "a.cpp", directory: ".") 62!2 = !{} 63!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !4, producer: "clang version 5.0.0 (trunk 294362) (llvm/trunk 294367)", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) 64!4 = !DIFile(filename: "b.cpp", directory: ".") 65!5 = !{!"clang version 5.0.0 (trunk 294362) (llvm/trunk 294367)"} 66!6 = !{i32 2, !"Dwarf Version", i32 4} 67!7 = !{i32 2, !"Debug Info Version", i32 3} 68!8 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 69!9 = !DISubroutineType(types: !10) 70!10 = !{null} 71!11 = !DILocation(line: 3, column: 3, scope: !8) 72!12 = !DILocation(line: 4, column: 1, scope: !8) 73!13 = distinct !DISubprogram(name: "f4", linkageName: "_Z2f4v", scope: !1, file: !1, line: 6, type: !9, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 74!14 = !DILocation(line: 3, column: 3, scope: !8, inlinedAt: !15) 75!15 = distinct !DILocation(line: 3, column: 3, scope: !16, inlinedAt: !18) 76!16 = distinct !DISubprogram(name: "f3", scope: !4, file: !4, line: 2, type: !17, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !3, retainedNodes: !2) 77!17 = !DISubroutineType(types: !2) 78!18 = distinct !DILocation(line: 7, column: 3, scope: !13) 79!19 = !DILocation(line: 8, column: 1, scope: !13) 80!20 = !DILocation(line: 3, column: 3, scope: !8, inlinedAt: !21) 81!21 = distinct !DILocation(line: 3, column: 3, scope: !16) 82!22 = !DILocation(line: 4, column: 1, scope: !16) 83