#include "llvm/ADT/OwningPtr.h"
#include "llvm/Bitcode/BitCodes.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/StreamableMemoryObject.h"
#include <climits>
#include <string>
#include <vector>
-#include "llvm/Support/StreamableMemoryObject.h"
namespace llvm {
/// block/record name information in the BlockInfo block. Only llvm-bcanalyzer
/// uses this.
bool IgnoreBlockInfoNames;
-
- BitstreamReader(const BitstreamReader&); // DO NOT IMPLEMENT
- void operator=(const BitstreamReader&); // DO NOT IMPLEMENT
+
+ BitstreamReader(const BitstreamReader&) LLVM_DELETED_FUNCTION;
+ void operator=(const BitstreamReader&) LLVM_DELETED_FUNCTION;
public:
BitstreamReader() : IgnoreBlockInfoNames(true) {
}
}
uint32_t getWord(size_t pos) {
- uint32_t word = -1;
+ uint8_t buf[sizeof(uint32_t)];
+ memset(buf, 0xFF, sizeof(buf));
BitStream->getBitcodeBytes().readBytes(pos,
- sizeof(word),
- reinterpret_cast<uint8_t *>(&word),
+ sizeof(buf),
+ buf,
NULL);
- return word;
+ return *reinterpret_cast<support::ulittle32_t *>(buf);
}
bool AtEndOfStream() {
}
/// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, enter
- /// the block, and return true if the block is valid.
+ /// the block, and return true if the block has an error.
bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP = 0) {
// Save the current block's state on BlockScope.
BlockScope.push_back(Block(CurCodeSize));