From e1c147c3cf68437b7a233feff3b95302a1b62201 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 28 Mar 2014 22:03:19 +0000 Subject: Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams" Committed this by accident before it was done last time. Original message: 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. llvm-svn: 205061 --- clang/lib/Serialization/GlobalModuleIndex.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'clang/lib/Serialization/GlobalModuleIndex.cpp') diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index b9e6130bad8..b4793610123 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -631,10 +631,12 @@ public: std::pair EmitKeyDataLength(raw_ostream& Out, key_type_ref Key, data_type_ref Data) { + using namespace llvm::support; + endian::Writer LE(Out); unsigned KeyLen = Key.size(); unsigned DataLen = Data.size() * 4; - clang::io::Emit16(Out, KeyLen); - clang::io::Emit16(Out, DataLen); + LE.write(KeyLen); + LE.write(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(Out).write(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(Out).write(0); BucketOffset = Generator.Emit(Out, Trait); } -- cgit v1.2.3