1*a282ea48SAlexandre Ganea // REQUIRES: x86-registered-target
2*a282ea48SAlexandre Ganea // RUN: rm -rf %t && mkdir %t && cd %t
3*a282ea48SAlexandre Ganea // RUN: cp %s debug-info-objname.cpp
4*a282ea48SAlexandre Ganea
5*a282ea48SAlexandre Ganea /// No output file provided, input file is relative, we emit an absolute path (MSVC behavior).
6*a282ea48SAlexandre Ganea // RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc debug-info-objname.cpp
7*a282ea48SAlexandre Ganea // RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
8*a282ea48SAlexandre Ganea
9*a282ea48SAlexandre Ganea /// No output file provided, input file is absolute, we emit an absolute path (MSVC behavior).
10*a282ea48SAlexandre Ganea // RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -- %t/debug-info-objname.cpp
11*a282ea48SAlexandre Ganea // RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
12*a282ea48SAlexandre Ganea
13*a282ea48SAlexandre Ganea /// The output file is provided as an absolute path, we emit an absolute path.
14*a282ea48SAlexandre Ganea // RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc /Fo%t/debug-info-objname.obj -- %t/debug-info-objname.cpp
15*a282ea48SAlexandre Ganea // RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
16*a282ea48SAlexandre Ganea
17*a282ea48SAlexandre Ganea /// The output file is provided as relative path, -working-dir is provided, we emit an absolute path.
18*a282ea48SAlexandre Ganea // RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -working-dir=%t debug-info-objname.cpp
19*a282ea48SAlexandre Ganea // RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
20*a282ea48SAlexandre Ganea
21*a282ea48SAlexandre Ganea /// The input file name is relative and we specify -fdebug-compilation-dir, we emit a relative path.
22*a282ea48SAlexandre Ganea // RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -fdebug-compilation-dir=. debug-info-objname.cpp
23*a282ea48SAlexandre Ganea // RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=RELATIVE
24*a282ea48SAlexandre Ganea
25*a282ea48SAlexandre Ganea /// Ensure /FA emits an .asm file which contains the path to the final .obj, not the .asm
26*a282ea48SAlexandre Ganea // RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -fdebug-compilation-dir=. /FA debug-info-objname.cpp
27*a282ea48SAlexandre Ganea // RUN: FileCheck --input-file=debug-info-objname.asm --check-prefix=ASM %s
28*a282ea48SAlexandre Ganea
29*a282ea48SAlexandre Ganea /// Same thing for -save-temps
30*a282ea48SAlexandre Ganea // RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -fdebug-compilation-dir=. /clang:-save-temps debug-info-objname.cpp
31*a282ea48SAlexandre Ganea // RUN: FileCheck --input-file=debug-info-objname.asm --check-prefix=ASM %s
32*a282ea48SAlexandre Ganea
main()33*a282ea48SAlexandre Ganea int main() {
34*a282ea48SAlexandre Ganea return 1;
35*a282ea48SAlexandre Ganea }
36*a282ea48SAlexandre Ganea
37*a282ea48SAlexandre Ganea // ABSOLUTE: S_OBJNAME [size = [[#]]] sig=0, `{{.+}}debug-info-objname.obj`
38*a282ea48SAlexandre Ganea // RELATIVE: S_OBJNAME [size = [[#]]] sig=0, `debug-info-objname.obj`
39*a282ea48SAlexandre Ganea // ASM: Record kind: S_OBJNAME
40*a282ea48SAlexandre Ganea // ASM-NEXT: .long 0
41*a282ea48SAlexandre Ganea // ASM-NEXT: .asciz "debug-info-objname.obj"
42