[llvm-bugs] [Bug 49793] New: [Windows] LLVM should canonicalize slashes and allow the user to override the default

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 31 11:24:45 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49793

            Bug ID: 49793
           Summary: [Windows] LLVM should canonicalize slashes and allow
                    the user to override the default
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

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:
https://reviews.llvm.org/D99580
https://bugs.llvm.org/show_bug.cgi?id=39025
https://bugs.llvm.org/show_bug.cgi?id=34497
 git grep -F '{[/' ../clang/test

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210331/eb4eb565/attachment.html>


More information about the llvm-bugs mailing list