diff options
| author | Justin Bogner <mail@justinbogner.com> | 2014-03-28 20:03:54 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2014-03-28 20:03:54 +0000 |
| commit | 366b49f98ea4778bb64d5b09219817ff26a2c215 (patch) | |
| tree | 6b9b317a1c56a480a1092d18f29c6b75cdee9247 /lib/Serialization/GlobalModuleIndex.cpp | |
| parent | 1665b62da4b8c62d404236101a217006e931fd39 (diff) | |
| download | clang-366b49f98ea4778bb64d5b09219817ff26a2c215.tar.gz clang-366b49f98ea4778bb64d5b09219817ff26a2c215.tar.bz2 clang-366b49f98ea4778bb64d5b09219817ff26a2c215.tar.xz | |
OnDiskHashTable: Use EndianStream.h to write little endian ostreams
Rather than rolling our own functions to write little endian data to
an ostream, we can use the support in llvm's EndianStream.h.
No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205044 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/GlobalModuleIndex.cpp')
| -rw-r--r-- | lib/Serialization/GlobalModuleIndex.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Serialization/GlobalModuleIndex.cpp b/lib/Serialization/GlobalModuleIndex.cpp index b9e6130bad..b479361012 100644 --- a/lib/Serialization/GlobalModuleIndex.cpp +++ b/lib/Serialization/GlobalModuleIndex.cpp @@ -631,10 +631,12 @@ public: std::pair<unsigned,unsigned> EmitKeyDataLength(raw_ostream& Out, key_type_ref Key, data_type_ref Data) { + using namespace llvm::support; + endian::Writer<little> LE(Out); unsigned KeyLen = Key.size(); unsigned DataLen = Data.size() * 4; - clang::io::Emit16(Out, KeyLen); - clang::io::Emit16(Out, DataLen); + LE.write<uint16_t>(KeyLen); + LE.write<uint16_t>(DataLen); return std::make_pair(KeyLen, DataLen); } @@ -644,8 +646,9 @@ public: void EmitData(raw_ostream& Out, key_type_ref Key, data_type_ref Data, unsigned DataLen) { + using namespace llvm::support; for (unsigned I = 0, N = Data.size(); I != N; ++I) - clang::io::Emit32(Out, Data[I]); + endian::Writer<little>(Out).write<uint32_t>(Data[I]); } }; @@ -707,9 +710,10 @@ void GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter &Stream) { SmallString<4096> IdentifierTable; uint32_t BucketOffset; { + using namespace llvm::support; llvm::raw_svector_ostream Out(IdentifierTable); // Make sure that no bucket is at offset 0 - clang::io::Emit32(Out, 0); + endian::Writer<little>(Out).write<uint32_t>(0); BucketOffset = Generator.Emit(Out, Trait); } |
