aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Reader/ReaderWrappers.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-09-23 15:09:26 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-09-23 15:09:26 +0000
commit5c344415fa0aeedffc2ed32e4e9be132aa0674ec (patch)
treefca1bcd556a56dd4824d01eeb08933cd6348356d /lib/Bytecode/Reader/ReaderWrappers.cpp
parent96f7877d198253e758b762ec9fe9efa1b4fd1dcd (diff)
* Constantify arguments to copy function
* Stop using a #define, make it an inline if statement git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/ReaderWrappers.cpp')
-rw-r--r--lib/Bytecode/Reader/ReaderWrappers.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Bytecode/Reader/ReaderWrappers.cpp b/lib/Bytecode/Reader/ReaderWrappers.cpp
index 2773d36e50..4931e12aff 100644
--- a/lib/Bytecode/Reader/ReaderWrappers.cpp
+++ b/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;