<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - clang-cl: Come up with a way to do the equivalent of %INCLUDE% via command-line flags"
   href="https://llvm.org/bugs/show_bug.cgi?id=26751">26751</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl: Come up with a way to do the equivalent of %INCLUDE% via command-line flags
          </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>Linux
          </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>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang-cl currently supports a bunch of magic env vars, like cl.exe. Passing
things in env vars is messy (for example: if you want to use clang-cl on Linux,
should the env var item separator be : or ;?), so we should have the ability to
do the same with flags.

I thought just exposing -isystem and then passing one -isystem flag per INCLUDE
entry would be enough, but that's sadly not the case:

1. If I misspell the -isystem flag to point to a nonexistent directory, they're
ignored and the "real" system includes are still picked up. -nostdlibinc fixes
that, but clang-cl doesn't expose that. We could expose this flag too, seems
like a good and easy fix.

2. But even then, the -isystem flags are now searched before the built-in
headers, which has the effect of e.g. `#include <stddef.h>` picking up the msvs
header instead of clang's version (and now offsetof is no longer constexpr
etc). I guess one fix for this would be to add an explicit -isystem flag
pointing to clang's builtin header dir, but this is getting a bit ugly.


Does anyone happen to have better suggestions on how to get the exact same
effect as setting %INCLUDE% with flags?</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>