r275261 - [PCH] Fix timestamp check on windows hosts.

Pierre Gousseau via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 13 04:58:30 PDT 2016

Author: pgousseau
Date: Wed Jul 13 06:58:28 2016
New Revision: 275261

URL: http://llvm.org/viewvc/llvm-project?rev=275261&view=rev
[PCH] Fix timestamp check on windows hosts.

On Linux, if the timestamp of a header file, included in the pch, is modified, then including the pch without regenerating it causes a fatal error, which is reasonable.
On Windows the check is ifdefed out, allowing the compilation to continue in a broken state.
The root of the broken state is that, if timestamps dont match, the preprocessor will reparse a header without discarding the pch data.
This leads to "#pragma once" header to be included twice.
The reason behind the ifdefing of the check lacks documentation, and was done 6 years ago.
This change tentatively removes the ifdefing.

First part of patch proposed at:

Differential Revision: http://reviews.llvm.org/D20867


Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=275261&r1=275260&r2=275261&view=diff
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Jul 13 06:58:28 2016
@@ -2010,17 +2010,8 @@ InputFile ASTReader::getInputFile(Module
   // For an overridden file, there is nothing to validate.
   if (!Overridden && //
       (StoredSize != File->getSize() ||
-#if defined(LLVM_ON_WIN32)
-       false
-       // In our regression testing, the Windows file system seems to
-       // have inconsistent modification times that sometimes
-       // erroneously trigger this error-handling path.
-       //
-       // FIXME: This probably also breaks HeaderFileInfo lookups on Windows.
        (StoredTime && StoredTime != File->getModificationTime() &&
        )) {
     if (Complain) {
       // Build a list of the PCH imports that got us here (in reverse).

More information about the cfe-commits mailing list