<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 - -frewrite-includes doesn't handle __has_include in macro expansion"
   href="https://bugs.llvm.org/show_bug.cgi?id=37990">37990</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-frewrite-includes doesn't handle __has_include in macro expansion
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>arichardson.kde@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I was trying to get a reduced test case for a crash in libc++ and QtBase but I
couldn't use clang -cc1 on the preprocessed source. It would fail with
compilation errors instead of the assertion I was trying to track down.
It turns out that both of these projects have a custom macro wrapping
__has_include()
and -frewrite-includes does not rewrite that to 0 or 1 so the invocation fails
on the rewritten source.

I have added a local hack to handle the Qt and libc++ macro names in
<a href="https://github.com/CTSRD-CHERI/clang/commit/05aafbf0c6cd7099b7d53466b58a8b8214d29f33">https://github.com/CTSRD-CHERI/clang/commit/05aafbf0c6cd7099b7d53466b58a8b8214d29f33</a>
but I guess a real fix is needed instead. If people are interested I'm happy to
put it up for review. Especially the libc++ macro is probably used in lots of
crash reproducers so it might help with getting a reduced test case from
C++-specific crashes.</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>