r296769 - Serialization: use the PCH chain to check PCH mode
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 2 09:37:11 PST 2017
Author: compnerd
Date: Thu Mar 2 11:37:11 2017
New Revision: 296769
URL: http://llvm.org/viewvc/llvm-project?rev=296769&view=rev
Log:
Serialization: use the PCH chain to check PCH mode
When we are deciding whether we are creating a PCH or a module, we would
check if the ModuleMgr had any elements to switch into PCH mode.
However, when creating a module, the size may be 1. This would result
in us going down the wrong path.
This was found by cross-compiling the swift standard library. Use the
PCH chain length instead to identify the PCH mode.
Unfortunately, I have not yet been able to create a simple test case for
this, but have verified that this fixes the swift standard library
construction.
Thanks to Adrian Prantl for help and discussions with this change!
Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=296769&r1=296768&r2=296769&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Mar 2 11:37:11 2017
@@ -7928,7 +7928,8 @@ ASTReader::getSourceDescriptor(unsigned
// If there is only a single PCH, return it instead.
// Chained PCH are not suported.
- if (ModuleMgr.size() == 1) {
+ const auto &PCHChain = ModuleMgr.pch_modules();
+ if (std::distance(std::begin(PCHChain), std::end(PCHChain))) {
ModuleFile &MF = ModuleMgr.getPrimaryModule();
StringRef ModuleName = llvm::sys::path::filename(MF.OriginalSourceFileName);
StringRef FileName = llvm::sys::path::filename(MF.FileName);
More information about the cfe-commits
mailing list