[llvm] r272437 - [pdb] Fix issues with pdb writing.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 10 14:47:27 PDT 2016
Author: zturner
Date: Fri Jun 10 16:47:26 2016
New Revision: 272437
URL: http://llvm.org/viewvc/llvm-project?rev=272437&view=rev
Log:
[pdb] Fix issues with pdb writing.
This fixes an alignment issue by forcing all cached allocations
to be 8 byte aligned, and also fixes an issue arising on big
endian systems by writing ulittle32_t's instead of uint32_t's
in the test.
Modified:
llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp?rev=272437&r1=272436&r2=272437&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp Fri Jun 10 16:47:26 2016
@@ -104,7 +104,7 @@ Error MappedBlockStream::readBytes(uint3
// into it, and return an ArrayRef to that. Do not touch existing pool
// allocations, as existing clients may be holding a pointer which must
// not be invalidated.
- uint8_t *WriteBuffer = Pool.Allocate<uint8_t>(Size);
+ uint8_t *WriteBuffer = static_cast<uint8_t *>(Pool.Allocate(Size, 8));
if (auto EC = readBytes(Offset, MutableArrayRef<uint8_t>(WriteBuffer, Size)))
return EC;
Modified: llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp?rev=272437&r1=272436&r2=272437&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp Fri Jun 10 16:47:26 2016
@@ -308,6 +308,7 @@ TEST(MappedBlockStreamTest, TestWriteThe
MappedBlockStreamImpl S(llvm::make_unique<IndexedStreamData>(0, F), F);
enum class MyEnum : uint32_t { Val1 = 2908234, Val2 = 120891234 };
+ using support::ulittle32_t;
uint16_t u16[] = {31468, 0};
uint32_t u32[] = {890723408, 0};
@@ -315,7 +316,9 @@ TEST(MappedBlockStreamTest, TestWriteThe
StringRef ZStr[] = {"Zero Str", ""};
StringRef FStr[] = {"Fixed Str", ""};
ArrayRef<uint8_t> byteArray[] = {{'1', '2'}, {'0', '0'}};
- ArrayRef<uint32_t> intArray[] = {{890723408, 29082234}, {0, 0}};
+ ArrayRef<support::ulittle32_t> intArray[] = {
+ {ulittle32_t(890723408), ulittle32_t(29082234)},
+ {ulittle32_t(0), ulittle32_t(0)}};
StreamReader Reader(S);
StreamWriter Writer(S);
More information about the llvm-commits
mailing list