diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2003-09-23 15:09:26 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2003-09-23 15:09:26 +0000 |
commit | 715fe875bb7ce50a9e758be89b85d638e6d6d19b (patch) | |
tree | 69799f07d34c920fc94901acf0b2ce09b115102b /llvm/lib/Bytecode/Reader/ReaderWrappers.cpp | |
parent | 3e18bc1518cef53128f51bdcd55df8e21f3080c3 (diff) | |
download | bcm5719-llvm-715fe875bb7ce50a9e758be89b85d638e6d6d19b.tar.gz bcm5719-llvm-715fe875bb7ce50a9e758be89b85d638e6d6d19b.zip |
* Constantify arguments to copy function
* Stop using a #define, make it an inline if statement
llvm-svn: 8678
Diffstat (limited to 'llvm/lib/Bytecode/Reader/ReaderWrappers.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Reader/ReaderWrappers.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp b/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp index 2773d36e504..4931e12aff1 100644 --- a/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp +++ b/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp @@ -11,11 +11,6 @@ #include "Config/unistd.h" #include "Config/sys/mman.h" -#define CHECK_ALIGN32(begin,end) \ - if (align32(begin,end)) \ - throw std::string("Alignment error: ReaderWrappers.cpp:" + \ - utostr((unsigned)__LINE__)); - namespace { /// BytecodeFileReader - parses a bytecode file from a file @@ -26,7 +21,7 @@ namespace { int Length; BytecodeFileReader(const BytecodeFileReader&); // Do not implement - void operator=(BytecodeFileReader &BFR); // Do not implement + void operator=(const BytecodeFileReader &BFR); // Do not implement public: BytecodeFileReader(const std::string &Filename); @@ -42,7 +37,7 @@ namespace { unsigned char *FileBuf; BytecodeStdinReader(const BytecodeStdinReader&); // Do not implement - void operator=(BytecodeStdinReader &BFR); // Do not implement + void operator=(const BytecodeStdinReader &BFR); // Do not implement public: BytecodeStdinReader(); @@ -143,7 +138,8 @@ BytecodeStdinReader::~BytecodeStdinReader() { AbstractModuleProvider* getBytecodeBufferModuleProvider(const unsigned char *Buffer, unsigned Length, const std::string &ModuleID) { - CHECK_ALIGN32(Buffer, Buffer+Length); + if (align32(Buffer, Buffer+Length) + throw std::string("Unaligned bytecode buffer."); BytecodeParser *Parser = new BytecodeParser(); Parser->ParseBytecode(Buffer, Length, ModuleID); return Parser; |