aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex/PTHManager.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-12-02 19:45:05 +0000
committerTed Kremenek <kremenek@apple.com>2008-12-02 19:45:05 +0000
commitbe1ee79d20db9cec7ef81d7a22ba2eaddc9c95b5 (patch)
tree8d7a7ee9314a8ee39e6cc096eb651855742bc9a8 /include/clang/Lex/PTHManager.h
parentfc7e2ead4306416b893c92693a2cb6d3b0492bdb (diff)
Added PTHManager, a utility class that will be used by Preprocessor to lazily create PTHLexer objects for pre-tokenized files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60436 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/PTHManager.h')
-rw-r--r--include/clang/Lex/PTHManager.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h
new file mode 100644
index 0000000000..fc37a8a151
--- /dev/null
+++ b/include/clang/Lex/PTHManager.h
@@ -0,0 +1,87 @@
+//===--- PTHManager.h - Manager object for PTH processing -------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the PTHManager interface.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_PTHMANAGER_H
+#define LLVM_CLANG_PTHMANAGER_H
+
+#include "clang/Lex/PTHLexer.h"
+#include "clang/Basic/LangOptions.h"
+#include <string>
+
+namespace llvm {
+ class MemoryBuffer;
+}
+
+namespace clang {
+
+class FileEntry;
+class IdentifierInfo;
+class IdentifierTable;
+
+class PTHManager {
+ /// The memory mapped PTH file.
+ const llvm::MemoryBuffer* Buf;
+
+ /// IdMap - A lazily generated cache mapping from persistent identifiers to
+ /// IdentifierInfo*.
+ void* PersistentIDCache;
+
+ /// FileLookup - Abstract data structure used for mapping between files
+ /// and token data in the PTH file.
+ void* FileLookup;
+
+ /// IdDataTable - Array representing the mapping from persistent IDs to the
+ /// data offset within the PTH file containing the information to
+ /// reconsitute an IdentifierInfo.
+ const char* IdDataTable;
+
+ /// ITable - The IdentifierTable used for the translation unit being lexed.
+ IdentifierTable& ITable;
+
+ /// PP - The Preprocessor object that will use this PTHManager to create
+ /// PTHLexer objects.
+ Preprocessor& PP;
+
+ /// This constructor is intended to only be called by the static 'Create'
+ /// method.
+ PTHManager(const llvm::MemoryBuffer* buf, void* fileLookup,
+ const char* idDataTable, Preprocessor& pp);
+
+ // Do not implement.
+ PTHManager();
+ void operator=(const PTHManager&);
+
+ /// ReadIdentifierInfo - Used by PTHManager to reconstruct IdentifierInfo
+ /// objects from the PTH file.
+ IdentifierInfo* ReadIdentifierInfo(const char*& D);
+
+ /// ReadToken - Used by PTHManager to read tokens from the PTH file.
+ void ReadToken(const char*& D, unsigned FileID, Token& T);
+
+public:
+
+ ~PTHManager();
+
+ /// Create - This method creates PTHManager objects. The 'file' argument
+ /// is the name of the PTH file. This method returns NULL upon failure.
+ static PTHManager* Create(const std::string& file, Preprocessor& PP);
+
+ /// CreateLexer - Return a PTHLexer that "lexes" the cached tokens for the
+ /// specified file. This method returns NULL if no cached tokens exist.
+ /// It is the responsibility of the caller to 'delete' the returned object.
+ PTHLexer* CreateLexer(unsigned FileID, const FileEntry* FE);
+};
+
+} // end namespace clang
+
+#endif