diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/CacheTokens.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Lex/PTHLexer.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReaderInternals.h | 8 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 13 | ||||
-rw-r--r-- | clang/lib/Serialization/GlobalModuleIndex.cpp | 11 |
5 files changed, 30 insertions, 27 deletions
diff --git a/clang/lib/Frontend/CacheTokens.cpp b/clang/lib/Frontend/CacheTokens.cpp index 2cb65826ad6..0d4d1c4710a 100644 --- a/clang/lib/Frontend/CacheTokens.cpp +++ b/clang/lib/Frontend/CacheTokens.cpp @@ -17,7 +17,6 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemStatCache.h" #include "clang/Basic/IdentifierTable.h" -#include "clang/Basic/OnDiskHashTable.h" #include "clang/Basic/SourceManager.h" #include "clang/Lex/Lexer.h" #include "clang/Lex/Preprocessor.h" @@ -26,6 +25,7 @@ #include "llvm/Support/EndianStream.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/OnDiskHashTable.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" @@ -35,12 +35,13 @@ #endif using namespace clang; -using namespace clang::io; //===----------------------------------------------------------------------===// // PTH-specific stuff. //===----------------------------------------------------------------------===// +typedef uint32_t Offset; + namespace { class PTHEntry { Offset TokenData, PPCondData; @@ -171,7 +172,7 @@ public: }; } // end anonymous namespace -typedef OnDiskChainedHashTableGenerator<FileEntryPTHEntryInfo> PTHMap; +typedef llvm::OnDiskChainedHashTableGenerator<FileEntryPTHEntryInfo> PTHMap; namespace { class PTHWriter { @@ -287,8 +288,11 @@ void PTHWriter::EmitToken(const Token& T) { PTHEntry PTHWriter::LexTokens(Lexer& L) { // Pad 0's so that we emit tokens to a 4-byte alignment. // This speed up reading them back in. - Pad(Out, 4); - Offset TokenOff = (Offset) Out.tell(); + using namespace llvm::support; + endian::Writer<little> LE(Out); + uint32_t TokenOff = Out.tell(); + for (uint64_t N = llvm::OffsetToAlignment(TokenOff, 4); N; --N, ++TokenOff) + LE.write<uint8_t>(0); // Keep track of matching '#if' ... '#endif'. typedef std::vector<std::pair<Offset, unsigned> > PPCondTable; @@ -636,7 +640,7 @@ std::pair<Offset,Offset> PTHWriter::EmitIdentifierTable() { PTHIdKey *IIDMap = (PTHIdKey*)calloc(idcount, sizeof(PTHIdKey)); // Create the hashtable. - OnDiskChainedHashTableGenerator<PTHIdentifierTableTrait> IIOffMap; + llvm::OnDiskChainedHashTableGenerator<PTHIdentifierTableTrait> IIOffMap; // Generate mapping from persistent IDs -> IdentifierInfo*. for (IDMap::iterator I = IM.begin(), E = IM.end(); I != E; ++I) { diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp index 1ca16d39b4d..f30e12157fe 100644 --- a/clang/lib/Lex/PTHLexer.cpp +++ b/clang/lib/Lex/PTHLexer.cpp @@ -15,7 +15,6 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemStatCache.h" #include "clang/Basic/IdentifierTable.h" -#include "clang/Basic/OnDiskHashTable.h" #include "clang/Basic/TokenKinds.h" #include "clang/Lex/LexDiagnostic.h" #include "clang/Lex/PTHManager.h" @@ -25,10 +24,10 @@ #include "llvm/ADT/StringMap.h" #include "llvm/Support/EndianStream.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/OnDiskHashTable.h" #include "llvm/Support/system_error.h" #include <memory> using namespace clang; -using namespace clang::io; #define DISK_TOKEN_SIZE (1+1+2+4+4) @@ -409,8 +408,8 @@ public: } // end anonymous namespace -typedef OnDiskChainedHashTable<PTHFileLookupTrait> PTHFileLookup; -typedef OnDiskChainedHashTable<PTHStringLookupTrait> PTHStringIdLookup; +typedef llvm::OnDiskChainedHashTable<PTHFileLookupTrait> PTHFileLookup; +typedef llvm::OnDiskChainedHashTable<PTHStringLookupTrait> PTHStringIdLookup; //===----------------------------------------------------------------------===// // PTHManager methods. @@ -693,7 +692,7 @@ public: }; class PTHStatCache : public FileSystemStatCache { - typedef OnDiskChainedHashTable<PTHStatLookupTrait> CacheTy; + typedef llvm::OnDiskChainedHashTable<PTHStatLookupTrait> CacheTy; CacheTy Cache; public: diff --git a/clang/lib/Serialization/ASTReaderInternals.h b/clang/lib/Serialization/ASTReaderInternals.h index fd328926eb3..7f0201b916d 100644 --- a/clang/lib/Serialization/ASTReaderInternals.h +++ b/clang/lib/Serialization/ASTReaderInternals.h @@ -14,9 +14,9 @@ #define LLVM_CLANG_SERIALIZATION_ASTREADER_INTERNALS_H #include "clang/AST/DeclarationName.h" -#include "clang/Basic/OnDiskHashTable.h" #include "clang/Serialization/ASTBitCodes.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/OnDiskHashTable.h" #include <sys/stat.h> #include <utility> @@ -140,7 +140,7 @@ public: /// \brief The on-disk hash table used to contain information about /// all of the identifiers in the program. -typedef OnDiskIterableChainedHashTable<ASTIdentifierLookupTrait> +typedef llvm::OnDiskIterableChainedHashTable<ASTIdentifierLookupTrait> ASTIdentifierLookupTable; /// \brief Class that performs lookup for a selector's entries in the global @@ -182,7 +182,7 @@ public: }; /// \brief The on-disk hash table used for the global method pool. -typedef OnDiskChainedHashTable<ASTSelectorLookupTrait> +typedef llvm::OnDiskChainedHashTable<ASTSelectorLookupTrait> ASTSelectorLookupTable; /// \brief Trait class used to search the on-disk hash table containing all of @@ -229,7 +229,7 @@ public: }; /// \brief The on-disk hash table used for known header files. -typedef OnDiskChainedHashTable<HeaderFileInfoTrait> +typedef llvm::OnDiskChainedHashTable<HeaderFileInfoTrait> HeaderFileInfoLookupTable; } // end namespace clang::serialization::reader diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 4e2c2e665b8..cb25fe6f886 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -25,7 +25,6 @@ #include "clang/AST/TypeLocVisitor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemStatCache.h" -#include "clang/Basic/OnDiskHashTable.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/SourceManagerInternals.h" #include "clang/Basic/TargetInfo.h" @@ -49,6 +48,7 @@ #include "llvm/Support/EndianStream.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/OnDiskHashTable.h" #include "llvm/Support/Path.h" #include <algorithm> #include <cstdio> @@ -1575,7 +1575,7 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS, StringRef isysroot) { FilesByUID.resize(HS.header_file_size()); HeaderFileInfoTrait GeneratorTrait(*this, HS); - OnDiskChainedHashTableGenerator<HeaderFileInfoTrait> Generator; + llvm::OnDiskChainedHashTableGenerator<HeaderFileInfoTrait> Generator; SmallVector<const char *, 4> SavedStrings; unsigned NumHeaderSearchEntries = 0; for (unsigned UID = 0, LastUID = FilesByUID.size(); UID != LastUID; ++UID) { @@ -1948,7 +1948,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP, bool IsModule) { llvm::array_pod_sort(MacroDirectives.begin(), MacroDirectives.end(), &compareMacroDirectives); - OnDiskChainedHashTableGenerator<ASTMacroTableTrait> Generator; + llvm::OnDiskChainedHashTableGenerator<ASTMacroTableTrait> Generator; // Emit the macro directives as a list and associate the offset with the // identifier they belong to. @@ -2834,7 +2834,7 @@ void ASTWriter::WriteSelectors(Sema &SemaRef) { unsigned NumTableEntries = 0; // Create and write out the blob that contains selectors and the method pool. { - OnDiskChainedHashTableGenerator<ASTMethodPoolTrait> Generator; + llvm::OnDiskChainedHashTableGenerator<ASTMethodPoolTrait> Generator; ASTMethodPoolTrait Trait(*this); // Create the on-disk hash table representation. We walk through every @@ -3260,7 +3260,7 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP, // Create and write out the blob that contains the identifier // strings. { - OnDiskChainedHashTableGenerator<ASTIdentifierTableTrait> Generator; + llvm::OnDiskChainedHashTableGenerator<ASTIdentifierTableTrait> Generator; ASTIdentifierTableTrait Trait(*this, PP, IdResolver, IsModule); // Look for any identifiers that were named while processing the @@ -3464,7 +3464,8 @@ ASTWriter::GenerateNameLookupTable(const DeclContext *DC, assert(!DC->LookupPtr.getInt() && "must call buildLookups first"); assert(DC == DC->getPrimaryContext() && "only primary DC has lookup table"); - OnDiskChainedHashTableGenerator<ASTDeclContextNameLookupTrait> Generator; + llvm::OnDiskChainedHashTableGenerator<ASTDeclContextNameLookupTrait> + Generator; ASTDeclContextNameLookupTrait Trait(*this); // Create the on-disk hash table representation. diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 631683d92f0..1649476342b 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -13,7 +13,6 @@ #include "ASTReaderInternals.h" #include "clang/Basic/FileManager.h" -#include "clang/Basic/OnDiskHashTable.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Serialization/ASTBitCodes.h" #include "clang/Serialization/GlobalModuleIndex.h" @@ -27,6 +26,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/LockFileManager.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/OnDiskHashTable.h" #include "llvm/Support/Path.h" #include <cstdio> using namespace clang; @@ -115,7 +115,7 @@ public: } }; -typedef OnDiskIterableChainedHashTable<IdentifierIndexReaderTrait> +typedef llvm::OnDiskIterableChainedHashTable<IdentifierIndexReaderTrait> IdentifierIndexTable; } @@ -611,9 +611,8 @@ bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) { // Handle the identifier table if (State == ASTBlock && Code == IDENTIFIER_TABLE && Record[0] > 0) { - typedef - OnDiskIterableChainedHashTable<InterestingASTIdentifierLookupTrait> - InterestingIdentifierTable; + typedef llvm::OnDiskIterableChainedHashTable< + InterestingASTIdentifierLookupTrait> InterestingIdentifierTable; std::unique_ptr<InterestingIdentifierTable> Table( InterestingIdentifierTable::Create( (const unsigned char *)Blob.data() + Record[0], @@ -718,7 +717,7 @@ void GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter &Stream) { // Write the identifier -> module file mapping. { - OnDiskChainedHashTableGenerator<IdentifierIndexWriterTrait> Generator; + llvm::OnDiskChainedHashTableGenerator<IdentifierIndexWriterTrait> Generator; IdentifierIndexWriterTrait Trait; // Populate the hash table. |