[llvm-bugs] [Bug 41579] New: Clang fails if run in the presence of GCC PCH files

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 24 06:37:50 PDT 2019


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

            Bug ID: 41579
           Summary: Clang fails if run in the presence of GCC PCH files
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: paul at mad-scientist.net
                CC: klimek at google.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

When GCC creates its precompiled headers it writes them into a GCC-specific
directory, <file>.gch, because the format is private to GCC.

Unfortunately when clang runs, it looks into the private GCC directory .gch for
precompiled headers as well, it detects the GCC percompiled headers, tries to
read them, and immediately fails because the format is different:

  $ g++ ... -Winvalid-pch --include=foo_pch.h ...
  $

But:

  $ clang++ ... --include=foo_pch.h ...
  error: no suitable precompiled header file found in directory
      './foo_pch.h.gch'
  1 error generated.

I don't want clang to read these precompiled headers: they're for GCC.  And I
don't want to have to create clang's precompiled headers because I'm just using
a tool built with libLLVM that does some code parsing, I don't need (and
actually can't create because this tool doesn't support it) precompiled
headers.

I just want clang to run, include the header file I've listed with my
--include=<foo>.h, and pay no attention to any GCC-specific precompiled headers
that it can't parse anyway.

Is there no option available to clang that will disable searching for PCH?  And
why does clang even try to look at GCC's PCH directory, if it can't parse GCC
PCH files anyway?

-- 
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/20190424/17144578/attachment.html>


More information about the llvm-bugs mailing list