Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Unified Diff: lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp

Issue 1122423005: Add (unsupported experimental) feature allowing byte aligned bitcode. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix issues in patch 2. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp
diff --git a/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp b/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp
index 3caab42e06d3067c258825071119ab50a6c9da48..f1b47eae6abad61b653919faf54badb8f2380b79 100644
--- a/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp
+++ b/lib/Bitcode/NaCl/Analysis/NaClBitcodeAnalyzer.cpp
@@ -408,9 +408,10 @@ int AnalyzeBitcodeInBuffer(const std::unique_ptr<MemoryBuffer> &Buf,
const unsigned char *BufPtr = (const unsigned char *)Buf->getBufferStart();
const unsigned char *EndBufPtr = BufPtr + Buf->getBufferSize();
+ const unsigned char *HeaderPtr = BufPtr;
jvoung (off chromium) 2015/05/08 17:55:01 I know Header.Read(x, ...) actually modifies x, bu
Karl 2015/05/08 21:09:00 I changed this a while back. The problem is that t
jvoung (off chromium) 2015/05/11 17:51:39 Thanks, that's easier to follow.
NaClBitcodeHeader Header;
- if (Header.Read(BufPtr, EndBufPtr))
+ if (Header.Read(HeaderPtr, EndBufPtr))
return Error("Invalid PNaCl bitcode header");
if (!Header.IsSupported())
@@ -419,7 +420,8 @@ int AnalyzeBitcodeInBuffer(const std::unique_ptr<MemoryBuffer> &Buf,
if (!Header.IsReadable())
Error("Bitcode file is not readable");
- NaClBitstreamReader StreamFile(BufPtr, EndBufPtr);
+ NaClBitstreamReader StreamFile(
+ getNonStreamedMemoryObject(BufPtr, EndBufPtr), Header);
NaClBitstreamCursor Stream(StreamFile);
unsigned NumTopBlocks = 0;

Powered by Google App Engine
This is Rietveld 408576698