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