mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 03:06:28 +00:00
[llvm-objdump] Print source when subsequent lines in the translation unit come from the same line in two different headers.
Reviewers: grimar, rupprecht, jhenderson Reviewed By: grimar, jhenderson Subscribers: llvm-commits, jhenderson Tags: #llvm Differential Revision: https://reviews.llvm.org/D62461 llvm-svn: 362771
This commit is contained in:
parent
c3c3847350
commit
74f20f58da
@ -0,0 +1 @@
|
||||
int add1(int a) { return a + 1; }
|
@ -0,0 +1 @@
|
||||
int return4() { return 4; }
|
@ -0,0 +1,2 @@
|
||||
#include "source-interleave-header1.h"
|
||||
#include "source-interleave-header2.h"
|
@ -0,0 +1,61 @@
|
||||
; NOTE: To be able to use this file as an input, the string SRC_COMPDIR needs
|
||||
; replacing with a directory path by using sed or similar.
|
||||
|
||||
; NOTE: This file was generated by running
|
||||
; clang -g -S -emit-llvm source-interleave-same-line-different-file.c -o \
|
||||
; source-interleave-same-line-different-file.ll
|
||||
|
||||
; ModuleID = 'source-interleave-same-line-different-file.c'
|
||||
source_filename = "source-interleave-same-line-different-file.c"
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Function Attrs: noinline nounwind optnone uwtable
|
||||
define dso_local i32 @add1(i32 %a) #0 !dbg !7 {
|
||||
entry:
|
||||
%a.addr = alloca i32, align 4
|
||||
store i32 %a, i32* %a.addr, align 4
|
||||
call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !12, metadata !DIExpression()), !dbg !13
|
||||
%0 = load i32, i32* %a.addr, align 4, !dbg !14
|
||||
%add = add nsw i32 %0, 1, !dbg !15
|
||||
ret i32 %add, !dbg !16
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone speculatable
|
||||
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
||||
|
||||
; Function Attrs: noinline nounwind optnone uwtable
|
||||
define dso_local i32 @return4() #0 !dbg !17 {
|
||||
entry:
|
||||
ret i32 4, !dbg !21
|
||||
}
|
||||
|
||||
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
||||
attributes #1 = { nounwind readnone speculatable }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!3, !4, !5}
|
||||
!llvm.ident = !{!6}
|
||||
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0 (https://github.com/llvm/llvm-project.git af0add6c39f7fcc641a2ae38753a9bc4eae47b28)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
|
||||
!1 = !DIFile(filename: "source-interleave-same-line-different-file.c", directory: "SRC_COMPDIR")
|
||||
!2 = !{}
|
||||
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
||||
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
!5 = !{i32 1, !"wchar_size", i32 4}
|
||||
!6 = !{!"clang version 9.0.0 (https://github.com/llvm/llvm-project.git af0add6c39f7fcc641a2ae38753a9bc4eae47b28)"}
|
||||
!7 = distinct !DISubprogram(name: "add1", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
|
||||
!8 = !DIFile(filename: "./source-interleave-header1.h", directory: "SRC_COMPDIR")
|
||||
!9 = !DISubroutineType(types: !10)
|
||||
!10 = !{!11, !11}
|
||||
!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
||||
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !8, line: 1, type: !11)
|
||||
!13 = !DILocation(line: 1, column: 14, scope: !7)
|
||||
!14 = !DILocation(line: 1, column: 26, scope: !7)
|
||||
!15 = !DILocation(line: 1, column: 28, scope: !7)
|
||||
!16 = !DILocation(line: 1, column: 19, scope: !7)
|
||||
!17 = distinct !DISubprogram(name: "return4", scope: !18, file: !18, line: 1, type: !19, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
|
||||
!18 = !DIFile(filename: "./source-interleave-header2.h", directory: "SRC_COMPDIR")
|
||||
!19 = !DISubroutineType(types: !20)
|
||||
!20 = !{!11}
|
||||
!21 = !DILocation(line: 1, column: 17, scope: !17)
|
@ -1,4 +1,4 @@
|
||||
; NOTE: To be able to use this file as an input, the string SRC_CMPDIR needs
|
||||
; NOTE: To be able to use this file as an input, the string SRC_COMPDIR needs
|
||||
; replacing with a directory path by using sed or similar.
|
||||
|
||||
; ModuleID = 'source-interleave-x86_64.bc'
|
||||
|
@ -0,0 +1,12 @@
|
||||
## Test that source is printed when subsequent lines in the translation unit
|
||||
## come from the same line in two different files.
|
||||
|
||||
# RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave-same-line-different-file.ll > %t.ll
|
||||
# RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll
|
||||
# RUN: llvm-objdump --source %t.o | FileCheck %s
|
||||
|
||||
# CHECK: 0000000000000000 add1:
|
||||
# CHECK-NEXT: ; int add1(int a) { return a + 1; }
|
||||
#
|
||||
# CHECK: 0000000000000010 return4:
|
||||
# CHECK-NEXT: ; int return4() { return 4; }
|
@ -579,8 +579,9 @@ void SourcePrinter::printSourceLine(raw_ostream &OS,
|
||||
else
|
||||
LineInfo = *ExpectedLineInfo;
|
||||
|
||||
if ((LineInfo.FileName == "<invalid>") || OldLineInfo.Line == LineInfo.Line ||
|
||||
LineInfo.Line == 0)
|
||||
if ((LineInfo.FileName == "<invalid>") || LineInfo.Line == 0 ||
|
||||
((OldLineInfo.Line == LineInfo.Line) &&
|
||||
(OldLineInfo.FileName == LineInfo.FileName)))
|
||||
return;
|
||||
|
||||
if (PrintLines)
|
||||
|
Loading…
x
Reference in New Issue
Block a user