<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 - clang-cl: <built-in> reported as included file for preprocessed source"
   href="https://bugs.llvm.org/show_bug.cgi?id=48132">48132</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl: <built-in> reported as included file for preprocessed source
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>andrey.vihrov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With clang-cl, when the compilation is split into separate preprocessing and
compilation steps, "<built-in>" is reported as included file when using
/showIncludes.

Let x.cpp be an empty file. Then,

    clang-cl /c /showIncludes x.cpp

succeeds with no output, as expected. However, running

    clang-cl /E x.cpp > pre.cpp
    clang-cl /c /showIncludes pre.cpp

outputs

    Note: including file: <built-in>

The contents of pre.cpp are

    # 1 "x.cpp"
    # 1 "<built-in>" 1
    # 1 "<built-in>" 3
    # 366 "<built-in>" 3
    # 1 "<command line>" 1
    # 1 "<built-in>" 2
    # 1 "x.cpp" 2

This is the relevant code:
<a href="https://github.com/llvm/llvm-project/blob/a7a447be0fa934505f0c423fb97b91a68c1cc715/clang/lib/Frontend/HeaderIncludeGen.cpp#L178-L179">https://github.com/llvm/llvm-project/blob/a7a447be0fa934505f0c423fb97b91a68c1cc715/clang/lib/Frontend/HeaderIncludeGen.cpp#L178-L179</a>.
Observe that it skips "<command line>", but not "<built-in>".

Note: MSVC reports no includes at all when /showIncludes is used on a
preprocessed source.</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>