aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bytecode/Writer
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-06-25 20:52:10 +0000
committerChris Lattner <sabre@nondot.org>2004-06-25 20:52:10 +0000
commit036de03128f6c512233b64de17736c1be058f024 (patch)
tree609e53543676fcf4250fb1e14461c8abbd2e6f96 /lib/Bytecode/Writer
parent34fa8714a47212ca422948e47651fcced4910051 (diff)
downloadexternal_llvm-036de03128f6c512233b64de17736c1be058f024.zip
external_llvm-036de03128f6c512233b64de17736c1be058f024.tar.gz
external_llvm-036de03128f6c512233b64de17736c1be058f024.tar.bz2
No functionality changes here:
* Some warning fixes for MSVC * Minor simplification to the deque scanning code git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer')
-rw-r--r--lib/Bytecode/Writer/Writer.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 3a17508..0f75c03 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -56,7 +56,7 @@ BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
// Output the version identifier... we are currently on bytecode version #2,
// which corresponds to LLVM v1.3.
- unsigned Version = (2 << 4) | isBigEndian | (hasLongPointers << 1) |
+ unsigned Version = (2 << 4) | (unsigned)isBigEndian | (hasLongPointers << 1) |
(hasNoEndianness << 2) | (hasNoPointerSize << 3);
output_vbr(Version, Out);
align32(Out);
@@ -203,7 +203,7 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
// Fields: bit0 = isConstant, bit1 = hasInitializer, bit2-4=Linkage,
// bit5+ = Slot # for type
unsigned oSlot = ((unsigned)Slot << 5) | (getEncodedLinkage(I) << 2) |
- (I->hasInitializer() << 1) | I->isConstant();
+ (I->hasInitializer() << 1) | (unsigned)I->isConstant();
output_vbr(oSlot, Out);
// If we have an initializer, output it now.
@@ -363,6 +363,7 @@ void llvm::WriteBytecodeToFile(const Module *C, std::ostream &Out) {
// sequential in memory, however, so write out as much as possible in big
// chunks, until we're done.
//
+
std::deque<unsigned char>::const_iterator I = Buffer.begin(),E = Buffer.end();
while (I != E) { // Loop until it's all written
// Scan to see how big this chunk is...
@@ -370,16 +371,12 @@ void llvm::WriteBytecodeToFile(const Module *C, std::ostream &Out) {
const unsigned char *LastPtr = ChunkPtr;
while (I != E) {
const unsigned char *ThisPtr = &*++I;
- if (LastPtr+1 != ThisPtr) { // Advanced by more than a byte of memory?
- ++LastPtr;
+ if (++LastPtr != ThisPtr) // Advanced by more than a byte of memory?
break;
- }
- LastPtr = ThisPtr;
}
// Write out the chunk...
Out.write((char*)ChunkPtr, unsigned(LastPtr-ChunkPtr));
}
-
Out.flush();
}