<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Windows] LLVM should canonicalize slashes and allow the user to override the default"
   href="https://bugs.llvm.org/show_bug.cgi?id=49793">49793</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Windows] LLVM should canonicalize slashes and allow the user to override the default
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rnk@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On Windows, it's easy to end up with paths with mixed slash directions. It's
easy to set up an example with clang-cl where the diagnostics contain mixed
slashes. There have been instances where debug info contains mixed slashes,
although it may depend on the format (DWARF vs codeview). In LLVM, we struggle
to write portable lit tests because our diagnostic output depends on the host
slash direction. To address these issues, LLVM needs a consistent policy.

My basic proposal is that we should treat slashes the way we treat text
encodings: we should canonicalize to forward slashes internally early, and then
canonicalize to the preferred separator when producing a diagnostic or
embedding the path in an output. This logic extends to LLVM IR and serialized
ASTs: I want the paths embedded in DIFile to contain forward slashes to make
testing the IR easier. Making native paths should happen when writing output
files intended for consumption by other tools, i.e. object files, executables,
PDBs, etc.

Finally, there should be a way for the user to override the default. No matter
what we do, there will be a user somewhere who prefers the other slash
direction, and we need to be able to point at an escape hatch to keep them
pacified.

Random links for context:
<a href="https://reviews.llvm.org/D99580">https://reviews.llvm.org/D99580</a>
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Don't automatically convert to forward slashes in Windows paths"
   href="show_bug.cgi?id=39025">https://bugs.llvm.org/show_bug.cgi?id=39025</a>
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - GoToDefinition does not properly replace slashes on Windows"
   href="show_bug.cgi?id=34497">https://bugs.llvm.org/show_bug.cgi?id=34497</a>
 git grep -F '{[/' ../clang/test</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>