[llvm] r226538 - AsmParser: Refactor duplicate code, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Jan 19 18:39:21 PST 2015
Author: dexonsmith
Date: Mon Jan 19 20:39:21 2015
New Revision: 226538
URL: http://llvm.org/viewvc/llvm-project?rev=226538&view=rev
Log:
AsmParser: Refactor duplicate code, NFC
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=226538&r1=226537&r2=226538&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jan 19 20:39:21 2015
@@ -2923,10 +2923,6 @@ bool LLParser::ParseMDNodeTail(MDNode *&
bool LLParser::ParseMDField(LocTy Loc, StringRef Name,
MDUnsignedField<uint32_t> &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, S
}
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(MD
#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)) \
More information about the llvm-commits
mailing list