aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-05-10 21:54:08 +0000
committerDouglas Gregor <dgregor@apple.com>2013-05-10 21:54:08 +0000
commitd7193795bd48bbacf3ab3f4d41801ad84c97d803 (patch)
tree93486e365426d0aeb8389a982139cce75e0c5af8 /clang/lib/Frontend/CompilerInvocation.cpp
parent38079fd26f150b3b43b99f720c93efe91e0760bb (diff)
downloadllvm-d7193795bd48bbacf3ab3f4d41801ad84c97d803.zip
llvm-d7193795bd48bbacf3ab3f4d41801ad84c97d803.tar.gz
llvm-d7193795bd48bbacf3ab3f4d41801ad84c97d803.tar.bz2
[Modules] Extend Darwin hack to include the modification time of SystemVersion.plist.
Fixes <rdar://problem/13856838>. llvm-svn: 181635
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 9c8eea1..6af3663 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -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::getModuleHash() const {
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::getModuleHash() const {
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);
}
}