<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 - tests in ClangScanDeps fail on Windows due to bad path concatenation"
   href="https://bugs.llvm.org/show_bug.cgi?id=46187">46187</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>tests in ClangScanDeps fail on Windows due to bad path concatenation
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ctetreau@quicinc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following tests fail on Windows:

Clang :: ClangScanDeps/header_stat_before_open.m
Clang :: ClangScanDeps/static-analyzer.c
Clang :: ClangScanDeps/vfsoverlay.cpp

After troubleshooting, I narrowed the issue down to line 785 of
clang/lib/Lex/HeaderSearch.cpp. On this line, rather than calling
llvm::sys::path::append, a filename is constructed by pushing '/' onto the end
of the directory name, then doing a string concat to append the file name. This
has a few issues including:

- not correctly handling directory names with an existing trailing path
separator
- not correctly handling windows path separators

A fix had previously been pushed
(<a href="https://github.com/llvm/llvm-project/commit/1cf6c28a9c0c507a224889263a20df42fd791cb9">https://github.com/llvm/llvm-project/commit/1cf6c28a9c0c507a224889263a20df42fd791cb9</a>),
then reverted
(<a href="https://github.com/llvm/llvm-project/commit/cf385dc8879f05581e94944d8ae7f00138c9ed72">https://github.com/llvm/llvm-project/commit/cf385dc8879f05581e94944d8ae7f00138c9ed72</a>)
for this. I attempted to restore the fix to see why it was reverted and noted
that it causes several test failures:

Clang-Unit.Tooling/Syntax/_/SyntaxTests_exe::TokenCollectorTest.MultiFile
Clang-Unit.Tooling/_/ToolingTests_exe::TransformerTest.MultipleFiles
Clang.Index/skip-parsed-bodies::compile_commands.json
Clang.Misc::remap-file.c
Clang.Modules::filename.cpp
Clang.Modules::malformed.cpp
Clang.Modules::module-debuginfo-prefix.m
Clang.Preprocessor::file_test_windows.c</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>