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