[llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp
Misha Brukman
brukman at cs.uiuc.edu
Tue Sep 23 10:10:08 PDT 2003
Changes in directory llvm/lib/Bytecode/Reader:
ReaderWrappers.cpp updated: 1.2 -> 1.3
---
Log message:
* Constantify arguments to copy function
* Stop using a #define, make it an inline if statement
---
Diffs of the changes:
Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp
diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.2 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.3
--- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.2 Mon Sep 22 18:44:46 2003
+++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Tue Sep 23 10:09:26 2003
@@ -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 @@
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 @@
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 @@
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;
More information about the llvm-commits
mailing list