r181635 - [Modules] Extend Darwin hack to include the modification time of SystemVersion.plist.

Douglas Gregor dgregor at apple.com
Fri May 10 14:54:08 PDT 2013


Author: dgregor
Date: Fri May 10 16:54:08 2013
New Revision: 181635

URL: http://llvm.org/viewvc/llvm-project?rev=181635&view=rev
Log:
[Modules] Extend Darwin hack to include the modification time of SystemVersion.plist.

Fixes <rdar://problem/13856838>.

Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=181635&r1=181634&r2=181635&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri May 10 16:54:08 2013
@@ -30,6 +30,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/system_error.h"
+#include <sys/stat.h>
 using namespace clang;
 
 //===----------------------------------------------------------------------===//
@@ -1689,7 +1690,8 @@ std::string CompilerInvocation::getModul
                       hsOpts.UseStandardCXXIncludes,
                       hsOpts.UseLibcxx);
 
-  // Darwin-specific hack: if we have a sysroot, use the contents of
+  // Darwin-specific hack: if we have a sysroot, use the contents and
+  // modification time of
   //   $sysroot/System/Library/CoreServices/SystemVersion.plist
   // as part of the module hash.
   if (!hsOpts.Sysroot.empty()) {
@@ -1702,6 +1704,10 @@ std::string CompilerInvocation::getModul
     llvm::sys::path::append(systemVersionFile, "SystemVersion.plist");
     if (!llvm::MemoryBuffer::getFile(systemVersionFile, buffer)) {
       code = hash_combine(code, buffer.get()->getBuffer());
+
+      struct stat statBuf;
+      if (stat(systemVersionFile.c_str(), &statBuf) == 0)
+        code = hash_combine(code, statBuf.st_mtime);
     }
   }
 





More information about the cfe-commits mailing list