diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-17 07:13:32 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-17 07:13:32 +0000 |
commit | e75ee0f0c8f8cf603c7894f9442f81faf11c2ff6 (patch) | |
tree | 9ff53065671bce8db52fea63c808f9494098b614 /clang/lib/Serialization/ASTReader.cpp | |
parent | 88edc8243d6d0c4f091d9f99e8916b0b52b456a2 (diff) | |
download | bcm5719-llvm-e75ee0f0c8f8cf603c7894f9442f81faf11c2ff6.tar.gz bcm5719-llvm-e75ee0f0c8f8cf603c7894f9442f81faf11c2ff6.zip |
[modules] When explicitly building a module file, don't include timestamps in
the produced pcm file for stable file creation across distributed build
systems.
llvm-svn: 245199
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 547dda73f73..6d41d155c56 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1500,13 +1500,14 @@ unsigned HeaderFileInfoTrait::ComputeHash(internal_key_ref ikey) { HeaderFileInfoTrait::internal_key_type HeaderFileInfoTrait::GetInternalKey(const FileEntry *FE) { - internal_key_type ikey = { FE->getSize(), FE->getModificationTime(), - FE->getName(), /*Imported*/false }; + internal_key_type ikey = {FE->getSize(), + M.HasTimestamps ? FE->getModificationTime() : 0, + FE->getName(), /*Imported*/ false}; return ikey; } bool HeaderFileInfoTrait::EqualKey(internal_key_ref a, internal_key_ref b) { - if (a.Size != b.Size || a.ModTime != b.ModTime) + if (a.Size != b.Size || (a.ModTime && b.ModTime && a.ModTime != b.ModTime)) return false; if (llvm::sys::path::is_absolute(a.Filename) && @@ -1976,14 +1977,9 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) { // have inconsistent modification times that sometimes // erroneously trigger this error-handling path. // - // This also happens in networked file systems, so disable this - // check if validation is disabled or if we have an explicitly - // built PCM file. - // - // FIXME: Should we also do this for PCH files? They could also - // reasonably get shared across a network during a distributed build. - (StoredTime != File->getModificationTime() && !DisableValidation && - F.Kind != MK_ExplicitModule) + // FIXME: This probably also breaks HeaderFileInfo lookups on Windows. + (StoredTime && StoredTime != File->getModificationTime() && + !DisableValidation) #endif )) { if (Complain) { @@ -2164,7 +2160,7 @@ ASTReader::ReadControlBlock(ModuleFile &F, return VersionMismatch; } - bool hasErrors = Record[5]; + bool hasErrors = Record[6]; if (hasErrors && !DisableValidation && !AllowASTWithCompilerErrors) { Diag(diag::err_pch_with_compiler_errors); return HadErrors; @@ -2175,6 +2171,8 @@ ASTReader::ReadControlBlock(ModuleFile &F, if (F.RelocatablePCH) F.BaseDirectory = isysroot.empty() ? "/" : isysroot; + F.HasTimestamps = Record[5]; + const std::string &CurBranch = getClangFullRepositoryVersion(); StringRef ASTBranch = Blob; if (StringRef(CurBranch) != ASTBranch && !DisableValidation) { |