From: Duncan P. N. Exon Smith Date: Mon, 19 Jan 2015 23:39:32 +0000 (+0000) Subject: AsmParser: Split up ParseMDFieldsImpl(), NFC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3a18dcb5722e06f50271c95c2d13c83e9867c0ed;p=oota-llvm.git AsmParser: Split up ParseMDFieldsImpl(), NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226526 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index ff313ce2d74..467ed484f92 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -2953,16 +2953,7 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, MDField &Result) { } template -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(ParserTy parseField, LocTy &ClosingLoc) { return true; } while (EatIfPresent(lltok::comma)); + return false; +} + +template +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"); } diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 8175fbd9352..ad311910a6f 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -422,6 +422,8 @@ namespace llvm { MDUnsignedField &Result); bool ParseMDField(LocTy Loc, StringRef Name, MDField &Result); template + bool ParseMDFieldsImplBody(ParserTy parseField); + template bool ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc); bool ParseSpecializedMDNode(MDNode *&N, bool IsDistinct = false); bool ParseMDLocation(MDNode *&Result, bool IsDistinct);