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