diff options
Diffstat (limited to 'include/clang/Lex/PTHManager.h')
-rw-r--r-- | include/clang/Lex/PTHManager.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h index 11b5cea..64ecf5f 100644 --- a/include/clang/Lex/PTHManager.h +++ b/include/clang/Lex/PTHManager.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_PTHMANAGER_H -#define LLVM_CLANG_PTHMANAGER_H +#ifndef LLVM_CLANG_LEX_PTHMANAGER_H +#define LLVM_CLANG_LEX_PTHMANAGER_H #include "clang/Basic/Diagnostic.h" #include "clang/Basic/IdentifierTable.h" @@ -20,6 +20,7 @@ #include "clang/Lex/PTHLexer.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/Allocator.h" +#include "llvm/Support/OnDiskHashTable.h" #include <string> namespace llvm { @@ -36,19 +37,26 @@ class FileSystemStatCache; class PTHManager : public IdentifierInfoLookup { friend class PTHLexer; + friend class PTHStatCache; + + class PTHStringLookupTrait; + class PTHFileLookupTrait; + typedef llvm::OnDiskChainedHashTable<PTHStringLookupTrait> PTHStringIdLookup; + typedef llvm::OnDiskChainedHashTable<PTHFileLookupTrait> PTHFileLookup; + /// The memory mapped PTH file. - const llvm::MemoryBuffer* Buf; + std::unique_ptr<const llvm::MemoryBuffer> Buf; /// Alloc - Allocator used for IdentifierInfo objects. llvm::BumpPtrAllocator Alloc; /// IdMap - A lazily generated cache mapping from persistent identifiers to /// IdentifierInfo*. - IdentifierInfo** PerIDCache; + std::unique_ptr<IdentifierInfo *[], llvm::FreeDeleter> PerIDCache; /// FileLookup - Abstract data structure used for mapping between files /// and token data in the PTH file. - void* FileLookup; + std::unique_ptr<PTHFileLookup> FileLookup; /// IdDataTable - Array representing the mapping from persistent IDs to the /// data offset within the PTH file containing the information to @@ -57,7 +65,7 @@ class PTHManager : public IdentifierInfoLookup { /// SortedIdTable - Abstract data structure mapping from strings to /// persistent IDs. This is used by get(). - void* StringIdLookup; + std::unique_ptr<PTHStringIdLookup> StringIdLookup; /// NumIds - The number of identifiers in the PTH file. const unsigned NumIds; @@ -76,10 +84,12 @@ class PTHManager : public IdentifierInfoLookup { /// This constructor is intended to only be called by the static 'Create' /// method. - PTHManager(const llvm::MemoryBuffer* buf, void* fileLookup, - const unsigned char* idDataTable, IdentifierInfo** perIDCache, - void* stringIdLookup, unsigned numIds, - const unsigned char* spellingBase, const char *originalSourceFile); + PTHManager(std::unique_ptr<const llvm::MemoryBuffer> buf, + std::unique_ptr<PTHFileLookup> fileLookup, + const unsigned char *idDataTable, + std::unique_ptr<IdentifierInfo *[], llvm::FreeDeleter> perIDCache, + std::unique_ptr<PTHStringIdLookup> stringIdLookup, unsigned numIds, + const unsigned char *spellingBase, const char *originalSourceFile); PTHManager(const PTHManager &) LLVM_DELETED_FUNCTION; void operator=(const PTHManager &) LLVM_DELETED_FUNCTION; @@ -131,7 +141,7 @@ public: /// FileManager objects. These objects use the PTH data to speed up /// calls to stat by memoizing their results from when the PTH file /// was generated. - FileSystemStatCache *createStatCache(); + std::unique_ptr<FileSystemStatCache> createStatCache(); }; } // end namespace clang |