aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-31 00:40:00 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-31 00:40:00 +0000
commitcc5888d833caf90ebda37f24da40d2cd06b4d820 (patch)
tree6dc571d547e7b6116db03fa68d26420f3fdb2aa2 /include/clang
parent036cdf05ef011f564fdec3cf949fbcec41a71a77 (diff)
Implement dependency analysis for the precompiled preamble. If any of
the files in the precompiled preamble have changed since it was build, force the preamble to be rebuilt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109937 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Basic/SourceManager.h6
-rw-r--r--include/clang/Frontend/ASTUnit.h13
2 files changed, 17 insertions, 2 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index b6a1ac4492..dc314f1f07 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -110,6 +110,12 @@ namespace SrcMgr {
Buffer.setPointer(B);
Buffer.setInt(false);
}
+
+ /// \brief Get the underlying buffer, returning NULL if the buffer is not
+ /// yet available.
+ const llvm::MemoryBuffer *getRawBuffer() const {
+ return Buffer.getPointer();
+ }
/// \brief Replace the existing buffer (which will be deleted)
/// with the given buffer.
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 56e73d9be4..b9db4beafd 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -21,6 +21,7 @@
#include "clang/Basic/FileManager.h"
#include "clang/Index/ASTLocation.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
#include "llvm/System/Path.h"
#include "llvm/Support/Timer.h"
#include <map>
@@ -28,6 +29,7 @@
#include <vector>
#include <cassert>
#include <utility>
+#include <sys/types.h>
namespace llvm {
class MemoryBuffer;
@@ -135,14 +137,21 @@ private:
/// \brief The size of the source buffer that we've reserved for the main
/// file within the precompiled preamble.
unsigned PreambleReservedSize;
-
+
+ /// \brief Keeps track of the files that were used when computing the
+ /// preamble, with both their buffer size and their modification time.
+ ///
+ /// If any of the files have changed from one compile to the next,
+ /// the preamble must be thrown away.
+ llvm::StringMap<std::pair<off_t, time_t> > FilesInPreamble;
+
/// \brief When non-NULL, this is the buffer used to store the contents of
/// the main file when it has been padded for use with the precompiled
/// preamble.
llvm::MemoryBuffer *SavedMainFileBuffer;
/// \brief The group of timers associated with this translation unit.
- llvm::OwningPtr<llvm::TimerGroup> TimerGroup;
+ llvm::OwningPtr<llvm::TimerGroup> TimerGroup;
/// \brief The timers we've created from the various parses, reparses, etc.
/// involved in this translation unit.