[llvm-bugs] [Bug 48132] New: clang-cl: <built-in> reported as included file for preprocessed source

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 10 04:44:35 PST 2020


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

            Bug ID: 48132
           Summary: clang-cl: <built-in> reported as included file for
                    preprocessed source
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.vihrov at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

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:
https://github.com/llvm/llvm-project/blob/a7a447be0fa934505f0c423fb97b91a68c1cc715/clang/lib/Frontend/HeaderIncludeGen.cpp#L178-L179.
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.

-- 
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/20201110/8cf48214/attachment.html>


More information about the llvm-bugs mailing list