Compiler projects using llvm
; RUN: rm -rf %t
; RUN: mkdir -p %t
; RUN: cd %t

; RUN: echo -e "0\n0" > %t.prof

; Test -gsplit-dwarf=single
; RUN: cp %S/Inputs/split-dwarf-single.exe %t/split-dwarf-single.exe
; RUN: yaml2obj %S/Inputs/split-dwarf-single.o.yaml -o %t/split-dwarf-single.o
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t.prof --binary=%t/split-dwarf-single.exe --output=%t1 --fill-zero-for-all-funcs
; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK-SPLIT-DWARF

; Test -gsplit-dwarf=split
; RUN: cp %S/Inputs/split-dwarf-split.exe %t/split-dwarf-split.exe
; RUN: yaml2obj %S/Inputs/split-dwarf-split.dwo.yaml -o %t/split-dwarf-split.dwo
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t.prof --binary=%t/split-dwarf-split.exe --output=%t2 --fill-zero-for-all-funcs
; RUN: FileCheck %s --input-file %t2 --check-prefix=CHECK-SPLIT-DWARF
; Test --dwp
; RUN: llvm-dwp %t/split-dwarf-split.dwo -o %t/split-dwarf-split.dwp
; RUN: llvm-profgen --format=text --unsymbolized-profile=%t.prof --dwp=%t/split-dwarf-split.dwp --binary=%t/split-dwarf-split.exe --output=%t3 --fill-zero-for-all-funcs
; RUN: FileCheck %s --input-file %t3 --check-prefix=CHECK-SPLIT-DWARF

; Make sure that all function ranges are well retrieved and have been populated with zero.

; CHECK-SPLIT-DWARF:       foo:0:0
; CHECK-SPLIT-DWARF-NEXT:   0: 0
; CHECK-SPLIT-DWARF-NEXT:   1: 0
; CHECK-SPLIT-DWARF-NEXT:  main:0:0
; CHECK-SPLIT-DWARF-NEXT:   0: 0
; CHECK-SPLIT-DWARF-NEXT:   1: 0
; CHECK-SPLIT-DWARF-NEXT:   2: 0


; Build instructions:
; split-dwarf-single.o:       clang -gsplit-dwarf=single -fdebug-compilation-dir=.  test.c   -fdebug-info-for-profiling  -O0 -g -o split-dwarf-single.o -c
; split-dwarf-single.exe:     clang -fdebug-compilation-dir=.  split-dwarf-single.o -o split-dwarf-single.exe  -fdebug-info-for-profiling  -O0 -g

; split-dwarf-split.dwo:      clang -gsplit-dwarf=split -fdebug-compilation-dir=.  test.c  -fdebug-info-for-profiling  -O0 -g -o split-dwarf-split.o -c
; split-dwarf-split.exe:      clang -fdebug-compilation-dir=.  split-dwarf-split.o -o split-dwarf-split.exe  -fdebug-info-for-profiling  -O0 -g

; Source code:

int foo() {
  return 1;
}

int main() {
  foo();
  return 0;
}