diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-14 00:45:20 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-14 00:45:20 +0000 |
commit | 23d8d0338e9878294dc16c78c1190be2245509d5 (patch) | |
tree | 8db61f6bd5e50e00bda6b777acd23d0b902e212a /clang/lib/Serialization/ASTWriter.cpp | |
parent | a0334a9277fa450f74ae0f99fa4e0850cf12641c (diff) | |
download | bcm5719-llvm-23d8d0338e9878294dc16c78c1190be2245509d5.tar.gz bcm5719-llvm-23d8d0338e9878294dc16c78c1190be2245509d5.zip |
[modules] Fix a #include cycle when building a module for our builtin headers.
xmmintrin.h includes emmintrin.h and vice versa if SSE2 is enabled. We break
this cycle for a modules build, and instead make the xmmintrin.h module
re-export the immintrin.h module. Also included is a fix for an assert in the
serialization code if a module exports another module that was declared later
in the same module map.
llvm-svn: 237321
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 0e6e5588390..29a88a13d38 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -2496,8 +2496,7 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) { Record.clear(); for (unsigned I = 0, N = Mod->Exports.size(); I != N; ++I) { if (Module *Exported = Mod->Exports[I].getPointer()) { - unsigned ExportedID = SubmoduleIDs[Exported]; - assert(ExportedID > 0 && "Unknown submodule ID?"); + unsigned ExportedID = getSubmoduleID(Exported); Record.push_back(ExportedID); } else { Record.push_back(0); @@ -2548,9 +2547,14 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) { } Stream.ExitBlock(); - - assert((NextSubmoduleID - FirstSubmoduleID - == getNumberOfModules(WritingModule)) && "Wrong # of submodules"); + + // FIXME: This can easily happen, if we have a reference to a submodule that + // did not result in us loading a module file for that submodule. For + // instance, a cross-top-level-module 'conflict' declaration will hit this. + assert((NextSubmoduleID - FirstSubmoduleID == + getNumberOfModules(WritingModule)) && + "Wrong # of submodules; found a reference to a non-local, " + "non-imported submodule?"); } serialization::SubmoduleID |