From: Duncan P. N. Exon Smith Date: Tue, 20 Jan 2015 02:39:21 +0000 (+0000) Subject: AsmParser: Refactor duplicate code, NFC X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=49254ea730eecc5d5dbbb3ee5b6b27ca05cf2769 AsmParser: Refactor duplicate code, NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226538 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 78818b288fa..442a49c43ac 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -2923,10 +2923,6 @@ bool LLParser::ParseMDNodeTail(MDNode *&N) { bool LLParser::ParseMDField(LocTy Loc, StringRef Name, MDUnsignedField &Result) { - if (Result.Seen) - return Error(Loc, - "field '" + Name + "' cannot be specified more than once"); - if (Lex.getKind() != lltok::APSInt || Lex.getAPSIntVal().isSigned()) return TokError("expected unsigned integer"); uint64_t Val64 = Lex.getAPSIntVal().getLimitedValue(Result.Max + 1ull); @@ -2940,10 +2936,6 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, } bool LLParser::ParseMDField(LocTy Loc, StringRef Name, MDField &Result) { - if (Result.Seen) - return Error(Loc, - "field '" + Name + "' cannot be specified more than once"); - Metadata *MD; if (ParseMetadata(MD, nullptr)) return true; @@ -3000,6 +2992,10 @@ bool LLParser::ParseSpecializedMDNode(MDNode *&N, bool IsDistinct) { #define PARSE_MD_FIELD(NAME, TYPE, DEFAULT) \ do { \ if (Lex.getStrVal() == #NAME) { \ + if (NAME.Seen) \ + return TokError("field '" #NAME \ + "' cannot be specified more than once"); \ + \ LocTy Loc = Lex.getLoc(); \ Lex.Lex(); \ if (ParseMDField(Loc, #NAME, NAME)) \