[llvm] r226526 - AsmParser: Split up ParseMDFieldsImpl(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Jan 19 15:39:33 PST 2015
Author: dexonsmith
Date: Mon Jan 19 17:39:32 2015
New Revision: 226526
URL: http://llvm.org/viewvc/llvm-project?rev=226526&view=rev
Log:
AsmParser: Split up ParseMDFieldsImpl(), NFC
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=226526&r1=226525&r2=226526&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jan 19 17:39:32 2015
@@ -2953,16 +2953,7 @@ bool LLParser::ParseMDField(LocTy Loc, S
}
template <class ParserTy>
-bool LLParser::ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc) {
- assert(Lex.getKind() == lltok::MetadataVar && "Expected metadata type name");
- Lex.Lex();
-
- if (ParseToken(lltok::lparen, "expected '(' here"))
- return true;
- ClosingLoc = Lex.getLoc();
- if (EatIfPresent(lltok::rparen))
- return false;
-
+bool LLParser::ParseMDFieldsImplBody(ParserTy parseField) {
do {
if (Lex.getKind() != lltok::LabelStr)
return TokError("expected field label here");
@@ -2971,6 +2962,20 @@ bool LLParser::ParseMDFieldsImpl(ParserT
return true;
} while (EatIfPresent(lltok::comma));
+ return false;
+}
+
+template <class ParserTy>
+bool LLParser::ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc) {
+ assert(Lex.getKind() == lltok::MetadataVar && "Expected metadata type name");
+ Lex.Lex();
+
+ if (ParseToken(lltok::lparen, "expected '(' here"))
+ return true;
+ if (Lex.getKind() != lltok::rparen)
+ if (ParseMDFieldsImplBody(parseField))
+ return true;
+
ClosingLoc = Lex.getLoc();
return ParseToken(lltok::rparen, "expected ')' here");
}
Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=226526&r1=226525&r2=226526&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Mon Jan 19 17:39:32 2015
@@ -422,6 +422,8 @@ namespace llvm {
MDUnsignedField<uint32_t> &Result);
bool ParseMDField(LocTy Loc, StringRef Name, MDField &Result);
template <class ParserTy>
+ bool ParseMDFieldsImplBody(ParserTy parseField);
+ template <class ParserTy>
bool ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc);
bool ParseSpecializedMDNode(MDNode *&N, bool IsDistinct = false);
bool ParseMDLocation(MDNode *&Result, bool IsDistinct);
More information about the llvm-commits
mailing list