[llvm] r235782 - LLParser: Simplify ParseInstructionMetadata(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Apr 24 14:29:36 PDT 2015
Author: dexonsmith
Date: Fri Apr 24 16:29:36 2015
New Revision: 235782
URL: http://llvm.org/viewvc/llvm-project?rev=235782&view=rev
Log:
LLParser: Simplify ParseInstructionMetadata(), NFC
Remove unused `PFS` variable and take the `Instruction` by reference.
(Not really related to PR23340, but might as well clean this up while
I'm here.)
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLParser.h
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=235782&r1=235781&r2=235782&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri Apr 24 16:29:36 2015
@@ -1504,8 +1504,7 @@ bool LLParser::ParseMetadataAttachment(u
/// ParseInstructionMetadata
/// ::= !dbg !42 (',' !dbg !57)*
-bool LLParser::ParseInstructionMetadata(Instruction *Inst,
- PerFunctionState *PFS) {
+bool LLParser::ParseInstructionMetadata(Instruction &Inst) {
do {
if (Lex.getKind() != lltok::MetadataVar)
return TokError("expected metadata after comma");
@@ -1515,9 +1514,9 @@ bool LLParser::ParseInstructionMetadata(
if (ParseMetadataAttachment(MDK, N))
return true;
- Inst->setMetadata(MDK, N);
+ Inst.setMetadata(MDK, N);
if (MDK == LLVMContext::MD_tbaa)
- InstsWithTBAATag.push_back(Inst);
+ InstsWithTBAATag.push_back(&Inst);
// If this is the end of the list, we're done.
} while (EatIfPresent(lltok::comma));
@@ -4396,7 +4395,7 @@ bool LLParser::ParseBasicBlock(PerFuncti
// With a normal result, we check to see if the instruction is followed by
// a comma and metadata.
if (EatIfPresent(lltok::comma))
- if (ParseInstructionMetadata(Inst, &PFS))
+ if (ParseInstructionMetadata(*Inst))
return true;
break;
case InstExtraComma:
@@ -4404,7 +4403,7 @@ bool LLParser::ParseBasicBlock(PerFuncti
// If the instruction parser ate an extra comma at the end of it, it
// *must* be followed by metadata.
- if (ParseInstructionMetadata(Inst, &PFS))
+ if (ParseInstructionMetadata(*Inst))
return true;
break;
}
Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=235782&r1=235781&r2=235782&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Fri Apr 24 16:29:36 2015
@@ -393,7 +393,7 @@ namespace llvm {
bool ParseMDNodeTail(MDNode *&MD);
bool ParseMDNodeVector(SmallVectorImpl<Metadata *> &MDs);
bool ParseMetadataAttachment(unsigned &Kind, MDNode *&MD);
- bool ParseInstructionMetadata(Instruction *Inst, PerFunctionState *PFS);
+ bool ParseInstructionMetadata(Instruction &Inst);
template <class FieldTy>
bool ParseMDField(LocTy Loc, StringRef Name, FieldTy &Result);
More information about the llvm-commits
mailing list