<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/117317>117317</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang emits wrong (escaped) path in preprocessor+assembler output on Windows
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            debuginfo,
            platform:windows
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aykevl
      </td>
    </tr>
</table>

<pre>
    Take this very simple assembly file:

```asm
foobar:
 nop
```

If I compile without the preprocessor, the `DW_AT_decl_file` under `DW_TAG_label` looks more or less correct:

```
$ clang -g --target=thumbv6m-unknown-unknown-eabi -c -o tmp/test.o "C:\Users\Ayke\src\tinygo\tinygo\tmp\test.s"

$ llvm-dwarfdump tmp/test.o
tmp/test.o:     file format elf32-littlearm

.debug_info contents:
0x00000000: Compile Unit: length = 0x0000006c, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x04 (next unit at 0x00000070)

0x0000000c: DW_TAG_compile_unit
 DW_AT_stmt_list   (0x00000000)
              DW_AT_low_pc (0x00000000)
              DW_AT_high_pc     (0x00000002)
 DW_AT_name        ("tmp\\test.s")
              DW_AT_comp_dir ("C:\\Users\\Ayke\\src\\tinygo\\tinygo")
 DW_AT_producer    ("clang version 19.1.4")
              DW_AT_language (DW_LANG_Mips_Assembler)

0x0000005b:   DW_TAG_label
 DW_AT_name      ("foobar")
                DW_AT_decl_file ("C:\Users\Ayke\src\tinygo\tinygo/tmp\test.s")
 DW_AT_decl_line (1)
                DW_AT_low_pc (0x00000000)

0x0000006f:   NULL
```

(There's a forward slash there for some reason, but that's not what this bug is about).

But when I compile with the preprocessor enabled (note `test.S` instead of `test.s`), the `DW_AT_decl_file` path seems to be escaped:

```
$ ~/scoop/apps/llvm/current/bin/clang -g --target=thumbv6m-unknown-unknown-eabi -c -o tmp/test.o "C:\Users\Ayke\src\tinygo\tinygo\tmp\test.S"

$ llvm-dwarfdump tmp/test.o
tmp/test.o:     file format elf32-littlearm

.debug_info contents:
0x00000000: Compile Unit: length = 0x00000093, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x04 (next unit at 0x00000097)

0x0000000c: DW_TAG_compile_unit
 DW_AT_stmt_list   (0x00000000)
              DW_AT_low_pc (0x00000000)
              DW_AT_high_pc     (0x00000002)
 DW_AT_name ("C:\\\\Users\\\\Ayke\\\\src\\\\tinygo\\\\tinygo\\\\tmp\\\\test.S")
 DW_AT_comp_dir ("C:\\Users\\Ayke\\src\\tinygo\\tinygo")
 DW_AT_producer    ("clang version 19.1.4")
              DW_AT_language (DW_LANG_Mips_Assembler)

0x00000082:   DW_TAG_label
 DW_AT_name      ("foobar")
                DW_AT_decl_file ("C:\\Users\\Ayke\\src\\tinygo\\tinygo\\tmp\\test.S")
 DW_AT_decl_line (8)
                DW_AT_low_pc (0x00000000)

0x00000096:   NULL
```

Also, the `DW_AT_name` even looks double-escaped!

This is my Clang version:

```
$ clang --version
clang version 19.1.4
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\Ayke\scoop\apps\llvm\19.1.4\bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcV0uPozgX_TXO5oqImJDHIos0UVot9deLr1OqJbLhAp4yNrJNUpnF_PaRgTzr0TWj0TwalVKJfa_vw8fnYGatKBXiisSfSLwZsdZV2qzY8Qn3csR1flzt2BOCq4SFPZojWFE3EoFZizWXRyiERBKtSbgh4elzFvZ_zNb9SKE1Z-ZsBko3d6bX_l8K-AKZrhshEQ7CVbp14CqExmBjdIbWakNo0o2RWbh5TNe7NMdMpl02sxBalaMZ5nbrz6lkHKWfkFo_Wai1QdAGJFoLmTYGM_dWEcNPOoVMMlVCUEIQOGZKdCTauKqt-X5WB616Uvqgzv-RcQFBBoEGVzeEbh1aN9ZA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