mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
AsmParser: PARSE_MD_FIELD() => ParseMDField(), NFC
Extract most of `PARSE_MD_FIELD()` into a function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49254ea730
commit
cb96a3132c
@ -2972,6 +2972,16 @@ bool LLParser::ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc) {
|
|||||||
return ParseToken(lltok::rparen, "expected ')' here");
|
return ParseToken(lltok::rparen, "expected ')' here");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class FieldTy>
|
||||||
|
bool LLParser::ParseMDField(StringRef Name, FieldTy &Result) {
|
||||||
|
if (Result.Seen)
|
||||||
|
return TokError("field '" + Name + "' cannot be specified more than once");
|
||||||
|
|
||||||
|
LocTy Loc = Lex.getLoc();
|
||||||
|
Lex.Lex();
|
||||||
|
return ParseMDField(Loc, Name, Result);
|
||||||
|
}
|
||||||
|
|
||||||
bool LLParser::ParseSpecializedMDNode(MDNode *&N, bool IsDistinct) {
|
bool LLParser::ParseSpecializedMDNode(MDNode *&N, bool IsDistinct) {
|
||||||
assert(Lex.getKind() == lltok::MetadataVar && "Expected metadata type name");
|
assert(Lex.getKind() == lltok::MetadataVar && "Expected metadata type name");
|
||||||
#define DISPATCH_TO_PARSER(CLASS) \
|
#define DISPATCH_TO_PARSER(CLASS) \
|
||||||
@ -2990,19 +3000,8 @@ bool LLParser::ParseSpecializedMDNode(MDNode *&N, bool IsDistinct) {
|
|||||||
if (!NAME.Seen) \
|
if (!NAME.Seen) \
|
||||||
return Error(ClosingLoc, "missing required field '" #NAME "'");
|
return Error(ClosingLoc, "missing required field '" #NAME "'");
|
||||||
#define PARSE_MD_FIELD(NAME, TYPE, DEFAULT) \
|
#define PARSE_MD_FIELD(NAME, TYPE, DEFAULT) \
|
||||||
do { \
|
if (Lex.getStrVal() == #NAME) \
|
||||||
if (Lex.getStrVal() == #NAME) { \
|
return ParseMDField(#NAME, 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)) \
|
|
||||||
return true; \
|
|
||||||
return false; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#define PARSE_MD_FIELDS() \
|
#define PARSE_MD_FIELDS() \
|
||||||
VISIT_MD_FIELDS(DECLARE_FIELD, DECLARE_FIELD) \
|
VISIT_MD_FIELDS(DECLARE_FIELD, DECLARE_FIELD) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -421,6 +421,7 @@ namespace llvm {
|
|||||||
bool ParseMDField(LocTy Loc, StringRef Name,
|
bool ParseMDField(LocTy Loc, StringRef Name,
|
||||||
MDUnsignedField<uint32_t> &Result);
|
MDUnsignedField<uint32_t> &Result);
|
||||||
bool ParseMDField(LocTy Loc, StringRef Name, MDField &Result);
|
bool ParseMDField(LocTy Loc, StringRef Name, MDField &Result);
|
||||||
|
template <class FieldTy> bool ParseMDField(StringRef Name, FieldTy &Result);
|
||||||
template <class ParserTy>
|
template <class ParserTy>
|
||||||
bool ParseMDFieldsImplBody(ParserTy parseField);
|
bool ParseMDFieldsImplBody(ParserTy parseField);
|
||||||
template <class ParserTy>
|
template <class ParserTy>
|
||||||
|
Loading…
Reference in New Issue
Block a user