diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-01 04:51:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-01 04:51:13 +0000 |
commit | fe805249f724629f1e90be81937274ea0ba78992 (patch) | |
tree | af3b040ab2c762e674fa501225a6a27e4ade09bf /lib/AsmParser/LLParser.cpp | |
parent | 68c551349947e659a79eb0d4782d0487756020b5 (diff) | |
download | external_llvm-fe805249f724629f1e90be81937274ea0ba78992.zip external_llvm-fe805249f724629f1e90be81937274ea0ba78992.tar.gz external_llvm-fe805249f724629f1e90be81937274ea0ba78992.tar.bz2 |
eliminate a temporary smallvector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100082 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 8083a07..5dc5a5e 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1078,9 +1078,7 @@ bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) { /// ParseInstructionMetadata /// ::= !dbg !42 (',' !dbg !57)* -bool LLParser:: -ParseInstructionMetadata(SmallVectorImpl<std::pair<unsigned, - MDNode *> > &Result){ +bool LLParser::ParseInstructionMetadata(Instruction *Inst) { do { if (Lex.getKind() != lltok::MetadataVar) return TokError("expected metadata after comma"); @@ -1094,7 +1092,7 @@ ParseInstructionMetadata(SmallVectorImpl<std::pair<unsigned, return true; unsigned MDK = M->getMDKindID(Name.c_str()); - Result.push_back(std::make_pair(MDK, Node)); + Inst->setMetadata(MDK, Node); // If this is the end of the list, we're done. } while (EatIfPresent(lltok::comma)); @@ -2896,22 +2894,17 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) { // With a normal result, we check to see if the instruction is followed by // a comma and metadata. if (EatIfPresent(lltok::comma)) - if (ParseInstructionMetadata(MetadataOnInst)) + if (ParseInstructionMetadata(Inst)) return true; break; case InstExtraComma: // If the instruction parser ate an extra comma at the end of it, it // *must* be followed by metadata. - if (ParseInstructionMetadata(MetadataOnInst)) + if (ParseInstructionMetadata(Inst)) return true; break; } - // Set metadata attached with this instruction. - for (unsigned i = 0, e = MetadataOnInst.size(); i != e; ++i) - Inst->setMetadata(MetadataOnInst[i].first, MetadataOnInst[i].second); - MetadataOnInst.clear(); - BB->getInstList().push_back(Inst); // Set the name on the instruction. |