diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp index b085581c60e..1b2ada0d493 100644 --- a/lib/Bytecode/Reader/InstructionReader.cpp +++ b/lib/Bytecode/Reader/InstructionReader.cpp @@ -14,15 +14,16 @@ #include "llvm/iPHINode.h" #include "llvm/iOther.h" -struct RawInst { // The raw fields out of the bytecode stream... - unsigned NumOperands; - unsigned Opcode; - unsigned Type; - - RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, - std::vector &Args); - -}; +namespace { + struct RawInst { // The raw fields out of the bytecode stream... + unsigned NumOperands; + unsigned Opcode; + unsigned Type; + + RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, + std::vector &Args); + }; +} @@ -102,8 +103,9 @@ RawInst::RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, Instruction *BytecodeParser::ParseInstruction(const unsigned char *&Buf, - const unsigned char *EndBuf) { - std::vector Args; + const unsigned char *EndBuf, + std::vector &Args) { + Args.clear(); RawInst RI(Buf, EndBuf, Args); const Type *InstTy = getType(RI.Type); diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index bf2b0118a35..ac380372372 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -200,7 +200,8 @@ BasicBlock *BytecodeParser::ParseBasicBlock(const unsigned char *&Buf, BB = ParsedBasicBlocks[BlockNo]; while (Buf < EndBuf) { - Instruction *Inst = ParseInstruction(Buf, EndBuf); + std::vector Args; + Instruction *Inst = ParseInstruction(Buf, EndBuf, Args); insertValue(Inst, Values); BB->getInstList().push_back(Inst); BCR_TRACE(4, Inst); diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h index 1fefe23fafb..2d75a321313 100644 --- a/lib/Bytecode/Reader/ReaderInternals.h +++ b/lib/Bytecode/Reader/ReaderInternals.h @@ -149,7 +149,8 @@ private: unsigned BlockNo); Instruction *ParseInstruction(const unsigned char *&Buf, - const unsigned char *End); + const unsigned char *End, + std::vector &Args); void ParseConstantPool(const unsigned char *&Buf, const unsigned char *EndBuf, ValueTable &Tab, TypeValuesListTy &TypeTab);