[LLVMbugs] [Bug 22405] New: Including llvm/Support/SourceMgr.h kills PCH

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 30 08:31:21 PST 2015


            Bug ID: 22405
           Summary: Including llvm/Support/SourceMgr.h kills PCH
           Product: libraries
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: tim.besard at elis.ugent.be
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13774
  --> http://llvm.org/bugs/attachment.cgi?id=13774&action=edit
Full compilation and error log (generating PCH + using it) using clang 3.5,
compiling against LLVM 3.6 headers.

If my to-be-precompiled header file (directly or indirectly) includes
"llvm/Support/SourceMgr.h", including the PCH when compiling other objects
generates an error:
llvm/Support/SourceMgr.h:48:10: error: call to deleted constructor of
  struct SrcBuffer {
(The rest of the error is snipped, I'll attach it in a log.)

How to reproduce:

-- headers.hpp ---------
#include <llvm/Support/SourceMgr.h>

-- test.cpp ------------
#include "headers.hpp"

int main() {
  return 0;

Compiling with LLVM/clang 3.5.1, and using those headers, everything works as

clang++ -I /usr/include -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS \
        -std=c++11 -x c++-header -o headers.hpp.pch headers.hpp
clang++ -std=c++11 -include headers.hpp -I /usr/include \
        -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -c -o test.o test.cpp
(compilation flags generated with llvm-config).

However, if I use my locally-built LLVM 3.6 installation (still compiling with
clang 3.5, but it doesn't matter, I also tried with clang 3.6), it fails:

clang++ -I ~/llvm-svn.release+assert/include -D__STDC_CONSTANT_MACROS \
        -D__STDC_LIMIT_MACROS -std=c++11 -x c++-header \
        -o headers.hpp.pch headers.hpp
clang++ -std=c++11 -include headers.hpp -I ~/llvm-svn.release+assert/include \
        -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -c -o test.o test.cpp

error: call to deleted constructor of 'std::unique_ptr<MemoryBuffer>'

Not precompiling the header, compiling against the 3.6 headers works fine:

clang++ -std=c++11 -I ~/llvm-svn.release+assert/include \
        -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -c -o test.o test.cpp

Tested on LLVM 3.6, r227537. CXXFLAGS used in this report are shortened (I used
the bare minimum for readability's sake), but I also tested it with the full
set of flags generated by `llvm-config --cxxflags`.

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/20150130/66ec1661/attachment.html>

More information about the llvm-bugs mailing list