MCParser: Update method names per coding guidelines.

s/AddDirectiveHandler/addDirectiveHandler/
s/ParseMSInlineAsm/parseMSInlineAsm/
s/ParseIdentifier/parseIdentifier/
s/ParseStringToEndOfStatement/parseStringToEndOfStatement/
s/ParseEscapedString/parseEscapedString/
s/EatToEndOfStatement/eatToEndOfStatement/
s/ParseExpression/parseExpression/
s/ParseParenExpression/parseParenExpression/
s/ParseAbsoluteExpression/parseAbsoluteExpression/
s/CheckForValidSection/checkForValidSection/

http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175675 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2013-02-20 22:21:35 +00:00
parent 6189288766
commit cb2ae3d98e
11 changed files with 363 additions and 363 deletions

View File

@ -65,7 +65,7 @@ protected: // Can only create subclasses.
public: public:
virtual ~MCAsmParser(); virtual ~MCAsmParser();
virtual void AddDirectiveHandler(StringRef Directive, virtual void addDirectiveHandler(StringRef Directive,
ExtensionDirectiveHandler Handler) = 0; ExtensionDirectiveHandler Handler) = 0;
virtual SourceMgr &getSourceManager() = 0; virtual SourceMgr &getSourceManager() = 0;
@ -92,8 +92,8 @@ public:
virtual void setParsingInlineAsm(bool V) = 0; virtual void setParsingInlineAsm(bool V) = 0;
virtual bool isParsingInlineAsm() = 0; virtual bool isParsingInlineAsm() = 0;
/// ParseMSInlineAsm - Parse ms-style inline assembly. /// parseMSInlineAsm - Parse ms-style inline assembly.
virtual bool ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, virtual bool parseMSInlineAsm(void *AsmLoc, std::string &AsmString,
unsigned &NumOutputs, unsigned &NumInputs, unsigned &NumOutputs, unsigned &NumInputs,
SmallVectorImpl<std::pair<void *, bool> > &OpDecls, SmallVectorImpl<std::pair<void *, bool> > &OpDecls,
SmallVectorImpl<std::string> &Constraints, SmallVectorImpl<std::string> &Constraints,
@ -126,50 +126,50 @@ public:
bool TokError(const Twine &Msg, bool TokError(const Twine &Msg,
ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()); ArrayRef<SMRange> Ranges = ArrayRef<SMRange>());
/// ParseIdentifier - Parse an identifier or string (as a quoted identifier) /// parseIdentifier - Parse an identifier or string (as a quoted identifier)
/// and set \p Res to the identifier contents. /// and set \p Res to the identifier contents.
virtual bool ParseIdentifier(StringRef &Res) = 0; virtual bool parseIdentifier(StringRef &Res) = 0;
/// \brief Parse up to the end of statement and return the contents from the /// \brief Parse up to the end of statement and return the contents from the
/// current token until the end of the statement; the current token on exit /// current token until the end of the statement; the current token on exit
/// will be either the EndOfStatement or EOF. /// will be either the EndOfStatement or EOF.
virtual StringRef ParseStringToEndOfStatement() = 0; virtual StringRef parseStringToEndOfStatement() = 0;
/// ParseEscapedString - Parse the current token as a string which may include /// parseEscapedString - Parse the current token as a string which may include
/// escaped characters and return the string contents. /// escaped characters and return the string contents.
virtual bool ParseEscapedString(std::string &Data) = 0; virtual bool parseEscapedString(std::string &Data) = 0;
/// EatToEndOfStatement - Skip to the end of the current statement, for error /// eatToEndOfStatement - Skip to the end of the current statement, for error
/// recovery. /// recovery.
virtual void EatToEndOfStatement() = 0; virtual void eatToEndOfStatement() = 0;
/// ParseExpression - Parse an arbitrary expression. /// parseExpression - Parse an arbitrary expression.
/// ///
/// @param Res - The value of the expression. The result is undefined /// @param Res - The value of the expression. The result is undefined
/// on error. /// on error.
/// @result - False on success. /// @result - False on success.
virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0; virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
bool ParseExpression(const MCExpr *&Res); bool parseExpression(const MCExpr *&Res);
/// ParseParenExpression - Parse an arbitrary expression, assuming that an /// parseParenExpression - Parse an arbitrary expression, assuming that an
/// initial '(' has already been consumed. /// initial '(' has already been consumed.
/// ///
/// @param Res - The value of the expression. The result is undefined /// @param Res - The value of the expression. The result is undefined
/// on error. /// on error.
/// @result - False on success. /// @result - False on success.
virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0; virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
/// ParseAbsoluteExpression - Parse an expression which must evaluate to an /// parseAbsoluteExpression - Parse an expression which must evaluate to an
/// absolute value. /// absolute value.
/// ///
/// @param Res - The value of the absolute expression. The result is undefined /// @param Res - The value of the absolute expression. The result is undefined
/// on error. /// on error.
/// @result - False on success. /// @result - False on success.
virtual bool ParseAbsoluteExpression(int64_t &Res) = 0; virtual bool parseAbsoluteExpression(int64_t &Res) = 0;
/// CheckForValidSection - Ensure that we have a valid section set in the /// checkForValidSection - Ensure that we have a valid section set in the
/// streamer. Otherwise, report an error and switch to .text. /// streamer. Otherwise, report an error and switch to .text.
virtual void CheckForValidSection() = 0; virtual void checkForValidSection() = 0;
}; };
/// \brief Create an MCAsmParser instance. /// \brief Create an MCAsmParser instance.

View File

@ -140,7 +140,7 @@ private:
/// ExtensionDirectiveMap - maps directive names to handler methods in parser /// ExtensionDirectiveMap - maps directive names to handler methods in parser
/// extensions. Extensions register themselves in this map by calling /// extensions. Extensions register themselves in this map by calling
/// AddDirectiveHandler. /// addDirectiveHandler.
StringMap<ExtensionDirectiveHandler> ExtensionDirectiveMap; StringMap<ExtensionDirectiveHandler> ExtensionDirectiveMap;
/// MacroMap - Map of currently defined macros. /// MacroMap - Map of currently defined macros.
@ -177,7 +177,7 @@ public:
virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false); virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false);
virtual void AddDirectiveHandler(StringRef Directive, virtual void addDirectiveHandler(StringRef Directive,
ExtensionDirectiveHandler Handler) { ExtensionDirectiveHandler Handler) {
ExtensionDirectiveMap[Directive] = Handler; ExtensionDirectiveMap[Directive] = Handler;
} }
@ -210,7 +210,7 @@ public:
void setParsingInlineAsm(bool V) { ParsingInlineAsm = V; } void setParsingInlineAsm(bool V) { ParsingInlineAsm = V; }
bool isParsingInlineAsm() { return ParsingInlineAsm; } bool isParsingInlineAsm() { return ParsingInlineAsm; }
bool ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, bool parseMSInlineAsm(void *AsmLoc, std::string &AsmString,
unsigned &NumOutputs, unsigned &NumInputs, unsigned &NumOutputs, unsigned &NumInputs,
SmallVectorImpl<std::pair<void *,bool> > &OpDecls, SmallVectorImpl<std::pair<void *,bool> > &OpDecls,
SmallVectorImpl<std::string> &Constraints, SmallVectorImpl<std::string> &Constraints,
@ -219,17 +219,17 @@ public:
const MCInstPrinter *IP, const MCInstPrinter *IP,
MCAsmParserSemaCallback &SI); MCAsmParserSemaCallback &SI);
bool ParseExpression(const MCExpr *&Res); bool parseExpression(const MCExpr *&Res);
virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc); virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc);
virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc); virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc);
virtual bool ParseAbsoluteExpression(int64_t &Res); virtual bool parseAbsoluteExpression(int64_t &Res);
/// ParseIdentifier - Parse an identifier or string (as a quoted identifier) /// parseIdentifier - Parse an identifier or string (as a quoted identifier)
/// and set \p Res to the identifier contents. /// and set \p Res to the identifier contents.
virtual bool ParseIdentifier(StringRef &Res); virtual bool parseIdentifier(StringRef &Res);
virtual void EatToEndOfStatement(); virtual void eatToEndOfStatement();
virtual void CheckForValidSection(); virtual void checkForValidSection();
/// } /// }
private: private:
@ -307,7 +307,7 @@ private:
/// \brief Parse up to the end of statement and a return the contents from the /// \brief Parse up to the end of statement and a return the contents from the
/// current token until the end of the statement; the current token on exit /// current token until the end of the statement; the current token on exit
/// will be either the EndOfStatement or EOF. /// will be either the EndOfStatement or EOF.
virtual StringRef ParseStringToEndOfStatement(); virtual StringRef parseStringToEndOfStatement();
/// \brief Parse until the end of a statement or a comma is encountered, /// \brief Parse until the end of a statement or a comma is encountered,
/// return the contents from the current token up to the end or comma. /// return the contents from the current token up to the end or comma.
@ -430,7 +430,7 @@ private:
bool ParseDirectiveElseIf(SMLoc DirectiveLoc); // ".elseif" bool ParseDirectiveElseIf(SMLoc DirectiveLoc); // ".elseif"
bool ParseDirectiveElse(SMLoc DirectiveLoc); // ".else" bool ParseDirectiveElse(SMLoc DirectiveLoc); // ".else"
bool ParseDirectiveEndIf(SMLoc DirectiveLoc); // .endif bool ParseDirectiveEndIf(SMLoc DirectiveLoc); // .endif
virtual bool ParseEscapedString(std::string &Data); virtual bool parseEscapedString(std::string &Data);
const MCExpr *ApplyModifierToExpr(const MCExpr *E, const MCExpr *ApplyModifierToExpr(const MCExpr *E,
MCSymbolRefExpr::VariantKind Variant); MCSymbolRefExpr::VariantKind Variant);
@ -618,7 +618,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
// We had an error, validate that one was emitted and recover by skipping to // We had an error, validate that one was emitted and recover by skipping to
// the next line. // the next line.
assert(HadError && "Parse statement returned an error, but none emitted!"); assert(HadError && "Parse statement returned an error, but none emitted!");
EatToEndOfStatement(); eatToEndOfStatement();
} }
if (TheCondState.TheCond != StartingCondState.TheCond || if (TheCondState.TheCond != StartingCondState.TheCond ||
@ -665,15 +665,15 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
return HadError; return HadError;
} }
void AsmParser::CheckForValidSection() { void AsmParser::checkForValidSection() {
if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
TokError("expected section directive before assembly directive"); TokError("expected section directive before assembly directive");
Out.InitToTextSection(); Out.InitToTextSection();
} }
} }
/// EatToEndOfStatement - Throw away the rest of the line for testing purposes. /// eatToEndOfStatement - Throw away the rest of the line for testing purposes.
void AsmParser::EatToEndOfStatement() { void AsmParser::eatToEndOfStatement() {
while (Lexer.isNot(AsmToken::EndOfStatement) && while (Lexer.isNot(AsmToken::EndOfStatement) &&
Lexer.isNot(AsmToken::Eof)) Lexer.isNot(AsmToken::Eof))
Lex(); Lex();
@ -683,7 +683,7 @@ void AsmParser::EatToEndOfStatement() {
Lex(); Lex();
} }
StringRef AsmParser::ParseStringToEndOfStatement() { StringRef AsmParser::parseStringToEndOfStatement() {
const char *Start = getTok().getLoc().getPointer(); const char *Start = getTok().getLoc().getPointer();
while (Lexer.isNot(AsmToken::EndOfStatement) && while (Lexer.isNot(AsmToken::EndOfStatement) &&
@ -712,7 +712,7 @@ StringRef AsmParser::ParseStringToComma() {
/// parenexpr ::= expr) /// parenexpr ::= expr)
/// ///
bool AsmParser::ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc) { bool AsmParser::ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc) {
if (ParseExpression(Res)) return true; if (parseExpression(Res)) return true;
if (Lexer.isNot(AsmToken::RParen)) if (Lexer.isNot(AsmToken::RParen))
return TokError("expected ')' in parentheses expression"); return TokError("expected ')' in parentheses expression");
EndLoc = Lexer.getTok().getEndLoc(); EndLoc = Lexer.getTok().getEndLoc();
@ -726,7 +726,7 @@ bool AsmParser::ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc) {
/// bracketexpr ::= expr] /// bracketexpr ::= expr]
/// ///
bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) { bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) {
if (ParseExpression(Res)) return true; if (parseExpression(Res)) return true;
if (Lexer.isNot(AsmToken::RBrac)) if (Lexer.isNot(AsmToken::RBrac))
return TokError("expected ']' in brackets expression"); return TokError("expected ']' in brackets expression");
EndLoc = Lexer.getTok().getEndLoc(); EndLoc = Lexer.getTok().getEndLoc();
@ -759,7 +759,7 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
case AsmToken::String: case AsmToken::String:
case AsmToken::Identifier: { case AsmToken::Identifier: {
StringRef Identifier; StringRef Identifier;
if (ParseIdentifier(Identifier)) { if (parseIdentifier(Identifier)) {
if (FirstTokenKind == AsmToken::Dollar) if (FirstTokenKind == AsmToken::Dollar)
return Error(FirstTokenLoc, "invalid token in expression"); return Error(FirstTokenLoc, "invalid token in expression");
return true; return true;
@ -864,9 +864,9 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
} }
} }
bool AsmParser::ParseExpression(const MCExpr *&Res) { bool AsmParser::parseExpression(const MCExpr *&Res) {
SMLoc EndLoc; SMLoc EndLoc;
return ParseExpression(Res, EndLoc); return parseExpression(Res, EndLoc);
} }
const MCExpr * const MCExpr *
@ -917,7 +917,7 @@ AsmParser::ApplyModifierToExpr(const MCExpr *E,
llvm_unreachable("Invalid expression kind!"); llvm_unreachable("Invalid expression kind!");
} }
/// ParseExpression - Parse an expression and return it. /// parseExpression - Parse an expression and return it.
/// ///
/// expr ::= expr &&,|| expr -> lowest. /// expr ::= expr &&,|| expr -> lowest.
/// expr ::= expr |,^,&,! expr /// expr ::= expr |,^,&,! expr
@ -927,7 +927,7 @@ AsmParser::ApplyModifierToExpr(const MCExpr *E,
/// expr ::= expr *,/,% expr -> highest. /// expr ::= expr *,/,% expr -> highest.
/// expr ::= primaryexpr /// expr ::= primaryexpr
/// ///
bool AsmParser::ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) { bool AsmParser::parseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
// Parse the expression. // Parse the expression.
Res = 0; Res = 0;
if (ParsePrimaryExpr(Res, EndLoc) || ParseBinOpRHS(1, Res, EndLoc)) if (ParsePrimaryExpr(Res, EndLoc) || ParseBinOpRHS(1, Res, EndLoc))
@ -965,17 +965,17 @@ bool AsmParser::ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
return false; return false;
} }
bool AsmParser::ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) { bool AsmParser::parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) {
Res = 0; Res = 0;
return ParseParenExpr(Res, EndLoc) || return ParseParenExpr(Res, EndLoc) ||
ParseBinOpRHS(1, Res, EndLoc); ParseBinOpRHS(1, Res, EndLoc);
} }
bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { bool AsmParser::parseAbsoluteExpression(int64_t &Res) {
const MCExpr *Expr; const MCExpr *Expr;
SMLoc StartLoc = Lexer.getLoc(); SMLoc StartLoc = Lexer.getLoc();
if (ParseExpression(Expr)) if (parseExpression(Expr))
return true; return true;
if (!Expr->EvaluateAsAbsolute(Res)) if (!Expr->EvaluateAsAbsolute(Res))
@ -1134,7 +1134,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
// Treat '.' as a valid identifier in this context. // Treat '.' as a valid identifier in this context.
Lex(); Lex();
IDVal = "."; IDVal = ".";
} else if (ParseIdentifier(IDVal)) { } else if (parseIdentifier(IDVal)) {
if (!TheCondState.Ignore) if (!TheCondState.Ignore)
return TokError("unexpected token at start of statement"); return TokError("unexpected token at start of statement");
IDVal = ""; IDVal = "";
@ -1177,7 +1177,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
// Ignore the statement if in the middle of inactive conditional // Ignore the statement if in the middle of inactive conditional
// (e.g. ".if 0"). // (e.g. ".if 0").
if (TheCondState.Ignore) { if (TheCondState.Ignore) {
EatToEndOfStatement(); eatToEndOfStatement();
return false; return false;
} }
@ -1186,7 +1186,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
// See what kind of statement we have. // See what kind of statement we have.
switch (Lexer.getKind()) { switch (Lexer.getKind()) {
case AsmToken::Colon: { case AsmToken::Colon: {
CheckForValidSection(); checkForValidSection();
// identifier ':' -> Label. // identifier ':' -> Label.
Lex(); Lex();
@ -1332,7 +1332,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
case DK_ZERO: case DK_ZERO:
return ParseDirectiveZero(); return ParseDirectiveZero();
case DK_EXTERN: case DK_EXTERN:
EatToEndOfStatement(); // .extern is the default, ignore it. eatToEndOfStatement(); // .extern is the default, ignore it.
return false; return false;
case DK_GLOBL: case DK_GLOBL:
case DK_GLOBAL: case DK_GLOBAL:
@ -1460,7 +1460,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) {
if (ParsingInlineAsm && (IDVal == "align" || IDVal == "ALIGN")) if (ParsingInlineAsm && (IDVal == "align" || IDVal == "ALIGN"))
return ParseDirectiveMSAlign(IDLoc, Info); return ParseDirectiveMSAlign(IDLoc, Info);
CheckForValidSection(); checkForValidSection();
// Canonicalize the opcode to lower case. // Canonicalize the opcode to lower case.
std::string OpcodeStr = IDVal.lower(); std::string OpcodeStr = IDVal.lower();
@ -2002,7 +2002,7 @@ bool AsmParser::ParseAssignment(StringRef Name, bool allow_redef,
SMLoc EqualLoc = Lexer.getLoc(); SMLoc EqualLoc = Lexer.getLoc();
const MCExpr *Value; const MCExpr *Value;
if (ParseExpression(Value)) if (parseExpression(Value))
return true; return true;
// Note: we don't count b as used in "a = b". This is to allow // Note: we don't count b as used in "a = b". This is to allow
@ -2059,10 +2059,10 @@ bool AsmParser::ParseAssignment(StringRef Name, bool allow_redef,
return false; return false;
} }
/// ParseIdentifier: /// parseIdentifier:
/// ::= identifier /// ::= identifier
/// ::= string /// ::= string
bool AsmParser::ParseIdentifier(StringRef &Res) { bool AsmParser::parseIdentifier(StringRef &Res) {
// The assembler has relaxed rules for accepting identifiers, in particular we // The assembler has relaxed rules for accepting identifiers, in particular we
// allow things like '.globl $foo', which would normally be separate // allow things like '.globl $foo', which would normally be separate
// tokens. At this level, we have already lexed so we cannot (currently) // tokens. At this level, we have already lexed so we cannot (currently)
@ -2105,7 +2105,7 @@ bool AsmParser::ParseIdentifier(StringRef &Res) {
bool AsmParser::ParseDirectiveSet(StringRef IDVal, bool allow_redef) { bool AsmParser::ParseDirectiveSet(StringRef IDVal, bool allow_redef) {
StringRef Name; StringRef Name;
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("expected identifier after '" + Twine(IDVal) + "'"); return TokError("expected identifier after '" + Twine(IDVal) + "'");
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
@ -2115,7 +2115,7 @@ bool AsmParser::ParseDirectiveSet(StringRef IDVal, bool allow_redef) {
return ParseAssignment(Name, allow_redef, true); return ParseAssignment(Name, allow_redef, true);
} }
bool AsmParser::ParseEscapedString(std::string &Data) { bool AsmParser::parseEscapedString(std::string &Data) {
assert(getLexer().is(AsmToken::String) && "Unexpected current token!"); assert(getLexer().is(AsmToken::String) && "Unexpected current token!");
Data = ""; Data = "";
@ -2177,14 +2177,14 @@ bool AsmParser::ParseEscapedString(std::string &Data) {
/// ::= ( .ascii | .asciz | .string ) [ "string" ( , "string" )* ] /// ::= ( .ascii | .asciz | .string ) [ "string" ( , "string" )* ]
bool AsmParser::ParseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) { bool AsmParser::ParseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
CheckForValidSection(); checkForValidSection();
for (;;) { for (;;) {
if (getLexer().isNot(AsmToken::String)) if (getLexer().isNot(AsmToken::String))
return TokError("expected string in '" + Twine(IDVal) + "' directive"); return TokError("expected string in '" + Twine(IDVal) + "' directive");
std::string Data; std::string Data;
if (ParseEscapedString(Data)) if (parseEscapedString(Data))
return true; return true;
getStreamer().EmitBytes(Data, DEFAULT_ADDRSPACE); getStreamer().EmitBytes(Data, DEFAULT_ADDRSPACE);
@ -2210,12 +2210,12 @@ bool AsmParser::ParseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) {
/// ::= (.byte | .short | ... ) [ expression (, expression)* ] /// ::= (.byte | .short | ... ) [ expression (, expression)* ]
bool AsmParser::ParseDirectiveValue(unsigned Size) { bool AsmParser::ParseDirectiveValue(unsigned Size) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
CheckForValidSection(); checkForValidSection();
for (;;) { for (;;) {
const MCExpr *Value; const MCExpr *Value;
SMLoc ExprLoc = getLexer().getLoc(); SMLoc ExprLoc = getLexer().getLoc();
if (ParseExpression(Value)) if (parseExpression(Value))
return true; return true;
// Special case constant expressions to match code generator. // Special case constant expressions to match code generator.
@ -2246,7 +2246,7 @@ bool AsmParser::ParseDirectiveValue(unsigned Size) {
/// ::= (.single | .double) [ expression (, expression)* ] /// ::= (.single | .double) [ expression (, expression)* ]
bool AsmParser::ParseDirectiveRealValue(const fltSemantics &Semantics) { bool AsmParser::ParseDirectiveRealValue(const fltSemantics &Semantics) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
CheckForValidSection(); checkForValidSection();
for (;;) { for (;;) {
// We don't truly support arithmetic on floating point expressions, so we // We don't truly support arithmetic on floating point expressions, so we
@ -2303,16 +2303,16 @@ bool AsmParser::ParseDirectiveRealValue(const fltSemantics &Semantics) {
/// ParseDirectiveZero /// ParseDirectiveZero
/// ::= .zero expression /// ::= .zero expression
bool AsmParser::ParseDirectiveZero() { bool AsmParser::ParseDirectiveZero() {
CheckForValidSection(); checkForValidSection();
int64_t NumBytes; int64_t NumBytes;
if (ParseAbsoluteExpression(NumBytes)) if (parseAbsoluteExpression(NumBytes))
return true; return true;
int64_t Val = 0; int64_t Val = 0;
if (getLexer().is(AsmToken::Comma)) { if (getLexer().is(AsmToken::Comma)) {
Lex(); Lex();
if (ParseAbsoluteExpression(Val)) if (parseAbsoluteExpression(Val))
return true; return true;
} }
@ -2329,10 +2329,10 @@ bool AsmParser::ParseDirectiveZero() {
/// ParseDirectiveFill /// ParseDirectiveFill
/// ::= .fill expression , expression , expression /// ::= .fill expression , expression , expression
bool AsmParser::ParseDirectiveFill() { bool AsmParser::ParseDirectiveFill() {
CheckForValidSection(); checkForValidSection();
int64_t NumValues; int64_t NumValues;
if (ParseAbsoluteExpression(NumValues)) if (parseAbsoluteExpression(NumValues))
return true; return true;
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
@ -2340,7 +2340,7 @@ bool AsmParser::ParseDirectiveFill() {
Lex(); Lex();
int64_t FillSize; int64_t FillSize;
if (ParseAbsoluteExpression(FillSize)) if (parseAbsoluteExpression(FillSize))
return true; return true;
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
@ -2348,7 +2348,7 @@ bool AsmParser::ParseDirectiveFill() {
Lex(); Lex();
int64_t FillExpr; int64_t FillExpr;
if (ParseAbsoluteExpression(FillExpr)) if (parseAbsoluteExpression(FillExpr))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -2368,11 +2368,11 @@ bool AsmParser::ParseDirectiveFill() {
/// ParseDirectiveOrg /// ParseDirectiveOrg
/// ::= .org expression [ , expression ] /// ::= .org expression [ , expression ]
bool AsmParser::ParseDirectiveOrg() { bool AsmParser::ParseDirectiveOrg() {
CheckForValidSection(); checkForValidSection();
const MCExpr *Offset; const MCExpr *Offset;
SMLoc Loc = getTok().getLoc(); SMLoc Loc = getTok().getLoc();
if (ParseExpression(Offset)) if (parseExpression(Offset))
return true; return true;
// Parse optional fill expression. // Parse optional fill expression.
@ -2382,7 +2382,7 @@ bool AsmParser::ParseDirectiveOrg() {
return TokError("unexpected token in '.org' directive"); return TokError("unexpected token in '.org' directive");
Lex(); Lex();
if (ParseAbsoluteExpression(FillExpr)) if (parseAbsoluteExpression(FillExpr))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -2403,11 +2403,11 @@ bool AsmParser::ParseDirectiveOrg() {
/// ParseDirectiveAlign /// ParseDirectiveAlign
/// ::= {.align, ...} expression [ , expression [ , expression ]] /// ::= {.align, ...} expression [ , expression [ , expression ]]
bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
CheckForValidSection(); checkForValidSection();
SMLoc AlignmentLoc = getLexer().getLoc(); SMLoc AlignmentLoc = getLexer().getLoc();
int64_t Alignment; int64_t Alignment;
if (ParseAbsoluteExpression(Alignment)) if (parseAbsoluteExpression(Alignment))
return true; return true;
SMLoc MaxBytesLoc; SMLoc MaxBytesLoc;
@ -2424,7 +2424,7 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
// .align 3,,4 // .align 3,,4
if (getLexer().isNot(AsmToken::Comma)) { if (getLexer().isNot(AsmToken::Comma)) {
HasFillExpr = true; HasFillExpr = true;
if (ParseAbsoluteExpression(FillExpr)) if (parseAbsoluteExpression(FillExpr))
return true; return true;
} }
@ -2434,7 +2434,7 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
Lex(); Lex();
MaxBytesLoc = getLexer().getLoc(); MaxBytesLoc = getLexer().getLoc();
if (ParseAbsoluteExpression(MaxBytesToFill)) if (parseAbsoluteExpression(MaxBytesToFill))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -2608,7 +2608,7 @@ bool AsmParser::ParseDirectiveLoc() {
StringRef Name; StringRef Name;
SMLoc Loc = getTok().getLoc(); SMLoc Loc = getTok().getLoc();
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("unexpected token in '.loc' directive"); return TokError("unexpected token in '.loc' directive");
if (Name == "basic_block") if (Name == "basic_block")
@ -2620,7 +2620,7 @@ bool AsmParser::ParseDirectiveLoc() {
else if (Name == "is_stmt") { else if (Name == "is_stmt") {
Loc = getTok().getLoc(); Loc = getTok().getLoc();
const MCExpr *Value; const MCExpr *Value;
if (ParseExpression(Value)) if (parseExpression(Value))
return true; return true;
// The expression must be the constant 0 or 1. // The expression must be the constant 0 or 1.
if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value)) { if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value)) {
@ -2639,7 +2639,7 @@ bool AsmParser::ParseDirectiveLoc() {
else if (Name == "isa") { else if (Name == "isa") {
Loc = getTok().getLoc(); Loc = getTok().getLoc();
const MCExpr *Value; const MCExpr *Value;
if (ParseExpression(Value)) if (parseExpression(Value))
return true; return true;
// The expression must be a constant greater or equal to 0. // The expression must be a constant greater or equal to 0.
if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value)) { if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value)) {
@ -2653,7 +2653,7 @@ bool AsmParser::ParseDirectiveLoc() {
} }
} }
else if (Name == "discriminator") { else if (Name == "discriminator") {
if (ParseAbsoluteExpression(Discriminator)) if (parseAbsoluteExpression(Discriminator))
return true; return true;
} }
else { else {
@ -2684,7 +2684,7 @@ bool AsmParser::ParseDirectiveCFISections() {
bool EH = false; bool EH = false;
bool Debug = false; bool Debug = false;
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("Expected an identifier"); return TokError("Expected an identifier");
if (Name == ".eh_frame") if (Name == ".eh_frame")
@ -2695,7 +2695,7 @@ bool AsmParser::ParseDirectiveCFISections() {
if (getLexer().is(AsmToken::Comma)) { if (getLexer().is(AsmToken::Comma)) {
Lex(); Lex();
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("Expected an identifier"); return TokError("Expected an identifier");
if (Name == ".eh_frame") if (Name == ".eh_frame")
@ -2732,7 +2732,7 @@ bool AsmParser::ParseRegisterOrRegisterNumber(int64_t &Register,
return true; return true;
Register = getContext().getRegisterInfo().getDwarfRegNum(RegNo, true); Register = getContext().getRegisterInfo().getDwarfRegNum(RegNo, true);
} else } else
return ParseAbsoluteExpression(Register); return parseAbsoluteExpression(Register);
return false; return false;
} }
@ -2749,7 +2749,7 @@ bool AsmParser::ParseDirectiveCFIDefCfa(SMLoc DirectiveLoc) {
Lex(); Lex();
int64_t Offset = 0; int64_t Offset = 0;
if (ParseAbsoluteExpression(Offset)) if (parseAbsoluteExpression(Offset))
return true; return true;
getStreamer().EmitCFIDefCfa(Register, Offset); getStreamer().EmitCFIDefCfa(Register, Offset);
@ -2760,7 +2760,7 @@ bool AsmParser::ParseDirectiveCFIDefCfa(SMLoc DirectiveLoc) {
/// ::= .cfi_def_cfa_offset offset /// ::= .cfi_def_cfa_offset offset
bool AsmParser::ParseDirectiveCFIDefCfaOffset() { bool AsmParser::ParseDirectiveCFIDefCfaOffset() {
int64_t Offset = 0; int64_t Offset = 0;
if (ParseAbsoluteExpression(Offset)) if (parseAbsoluteExpression(Offset))
return true; return true;
getStreamer().EmitCFIDefCfaOffset(Offset); getStreamer().EmitCFIDefCfaOffset(Offset);
@ -2790,7 +2790,7 @@ bool AsmParser::ParseDirectiveCFIRegister(SMLoc DirectiveLoc) {
/// ::= .cfi_adjust_cfa_offset adjustment /// ::= .cfi_adjust_cfa_offset adjustment
bool AsmParser::ParseDirectiveCFIAdjustCfaOffset() { bool AsmParser::ParseDirectiveCFIAdjustCfaOffset() {
int64_t Adjustment = 0; int64_t Adjustment = 0;
if (ParseAbsoluteExpression(Adjustment)) if (parseAbsoluteExpression(Adjustment))
return true; return true;
getStreamer().EmitCFIAdjustCfaOffset(Adjustment); getStreamer().EmitCFIAdjustCfaOffset(Adjustment);
@ -2821,7 +2821,7 @@ bool AsmParser::ParseDirectiveCFIOffset(SMLoc DirectiveLoc) {
return TokError("unexpected token in directive"); return TokError("unexpected token in directive");
Lex(); Lex();
if (ParseAbsoluteExpression(Offset)) if (parseAbsoluteExpression(Offset))
return true; return true;
getStreamer().EmitCFIOffset(Register, Offset); getStreamer().EmitCFIOffset(Register, Offset);
@ -2841,7 +2841,7 @@ bool AsmParser::ParseDirectiveCFIRelOffset(SMLoc DirectiveLoc) {
Lex(); Lex();
int64_t Offset = 0; int64_t Offset = 0;
if (ParseAbsoluteExpression(Offset)) if (parseAbsoluteExpression(Offset))
return true; return true;
getStreamer().EmitCFIRelOffset(Register, Offset); getStreamer().EmitCFIRelOffset(Register, Offset);
@ -2876,7 +2876,7 @@ static bool isValidEncoding(int64_t Encoding) {
/// ::= .cfi_lsda encoding, [symbol_name] /// ::= .cfi_lsda encoding, [symbol_name]
bool AsmParser::ParseDirectiveCFIPersonalityOrLsda(bool IsPersonality) { bool AsmParser::ParseDirectiveCFIPersonalityOrLsda(bool IsPersonality) {
int64_t Encoding = 0; int64_t Encoding = 0;
if (ParseAbsoluteExpression(Encoding)) if (parseAbsoluteExpression(Encoding))
return true; return true;
if (Encoding == dwarf::DW_EH_PE_omit) if (Encoding == dwarf::DW_EH_PE_omit)
return false; return false;
@ -2889,7 +2889,7 @@ bool AsmParser::ParseDirectiveCFIPersonalityOrLsda(bool IsPersonality) {
Lex(); Lex();
StringRef Name; StringRef Name;
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
@ -2943,7 +2943,7 @@ bool AsmParser::ParseDirectiveCFIRestore(SMLoc DirectiveLoc) {
bool AsmParser::ParseDirectiveCFIEscape() { bool AsmParser::ParseDirectiveCFIEscape() {
std::string Values; std::string Values;
int64_t CurrValue; int64_t CurrValue;
if (ParseAbsoluteExpression(CurrValue)) if (parseAbsoluteExpression(CurrValue))
return true; return true;
Values.push_back((uint8_t)CurrValue); Values.push_back((uint8_t)CurrValue);
@ -2951,7 +2951,7 @@ bool AsmParser::ParseDirectiveCFIEscape() {
while (getLexer().is(AsmToken::Comma)) { while (getLexer().is(AsmToken::Comma)) {
Lex(); Lex();
if (ParseAbsoluteExpression(CurrValue)) if (parseAbsoluteExpression(CurrValue))
return true; return true;
Values.push_back((uint8_t)CurrValue); Values.push_back((uint8_t)CurrValue);
@ -3000,7 +3000,7 @@ bool AsmParser::ParseDirectiveMacrosOnOff(StringRef Directive) {
/// ::= .macro name [parameters] /// ::= .macro name [parameters]
bool AsmParser::ParseDirectiveMacro(SMLoc DirectiveLoc) { bool AsmParser::ParseDirectiveMacro(SMLoc DirectiveLoc) {
StringRef Name; StringRef Name;
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("expected identifier in '.macro' directive"); return TokError("expected identifier in '.macro' directive");
MCAsmMacroParameters Parameters; MCAsmMacroParameters Parameters;
@ -3010,7 +3010,7 @@ bool AsmParser::ParseDirectiveMacro(SMLoc DirectiveLoc) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
for (;;) { for (;;) {
MCAsmMacroParameter Parameter; MCAsmMacroParameter Parameter;
if (ParseIdentifier(Parameter.first)) if (parseIdentifier(Parameter.first))
return TokError("expected identifier in '.macro' directive"); return TokError("expected identifier in '.macro' directive");
if (getLexer().is(AsmToken::Equal)) { if (getLexer().is(AsmToken::Equal)) {
@ -3052,7 +3052,7 @@ bool AsmParser::ParseDirectiveMacro(SMLoc DirectiveLoc) {
} }
// Otherwise, scan til the end of the statement. // Otherwise, scan til the end of the statement.
EatToEndOfStatement(); eatToEndOfStatement();
} }
if (LookupMacro(Name)) { if (LookupMacro(Name)) {
@ -3193,7 +3193,7 @@ bool AsmParser::ParseDirectiveEndMacro(StringRef Directive) {
/// ::= .purgem /// ::= .purgem
bool AsmParser::ParseDirectivePurgeMacro(SMLoc DirectiveLoc) { bool AsmParser::ParseDirectivePurgeMacro(SMLoc DirectiveLoc) {
StringRef Name; StringRef Name;
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("expected identifier in '.purgem' directive"); return TokError("expected identifier in '.purgem' directive");
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -3209,13 +3209,13 @@ bool AsmParser::ParseDirectivePurgeMacro(SMLoc DirectiveLoc) {
/// ParseDirectiveBundleAlignMode /// ParseDirectiveBundleAlignMode
/// ::= {.bundle_align_mode} expression /// ::= {.bundle_align_mode} expression
bool AsmParser::ParseDirectiveBundleAlignMode() { bool AsmParser::ParseDirectiveBundleAlignMode() {
CheckForValidSection(); checkForValidSection();
// Expect a single argument: an expression that evaluates to a constant // Expect a single argument: an expression that evaluates to a constant
// in the inclusive range 0-30. // in the inclusive range 0-30.
SMLoc ExprLoc = getLexer().getLoc(); SMLoc ExprLoc = getLexer().getLoc();
int64_t AlignSizePow2; int64_t AlignSizePow2;
if (ParseAbsoluteExpression(AlignSizePow2)) if (parseAbsoluteExpression(AlignSizePow2))
return true; return true;
else if (getLexer().isNot(AsmToken::EndOfStatement)) else if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token after expression in" return TokError("unexpected token after expression in"
@ -3235,7 +3235,7 @@ bool AsmParser::ParseDirectiveBundleAlignMode() {
/// ParseDirectiveBundleLock /// ParseDirectiveBundleLock
/// ::= {.bundle_lock} [align_to_end] /// ::= {.bundle_lock} [align_to_end]
bool AsmParser::ParseDirectiveBundleLock() { bool AsmParser::ParseDirectiveBundleLock() {
CheckForValidSection(); checkForValidSection();
bool AlignToEnd = false; bool AlignToEnd = false;
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
@ -3244,7 +3244,7 @@ bool AsmParser::ParseDirectiveBundleLock() {
const char *kInvalidOptionError = const char *kInvalidOptionError =
"invalid option for '.bundle_lock' directive"; "invalid option for '.bundle_lock' directive";
if (ParseIdentifier(Option)) if (parseIdentifier(Option))
return Error(Loc, kInvalidOptionError); return Error(Loc, kInvalidOptionError);
if (Option != "align_to_end") if (Option != "align_to_end")
@ -3264,7 +3264,7 @@ bool AsmParser::ParseDirectiveBundleLock() {
/// ParseDirectiveBundleLock /// ParseDirectiveBundleLock
/// ::= {.bundle_lock} /// ::= {.bundle_lock}
bool AsmParser::ParseDirectiveBundleUnlock() { bool AsmParser::ParseDirectiveBundleUnlock() {
CheckForValidSection(); checkForValidSection();
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.bundle_unlock' directive"); return TokError("unexpected token in '.bundle_unlock' directive");
@ -3277,10 +3277,10 @@ bool AsmParser::ParseDirectiveBundleUnlock() {
/// ParseDirectiveSpace /// ParseDirectiveSpace
/// ::= (.skip | .space) expression [ , expression ] /// ::= (.skip | .space) expression [ , expression ]
bool AsmParser::ParseDirectiveSpace(StringRef IDVal) { bool AsmParser::ParseDirectiveSpace(StringRef IDVal) {
CheckForValidSection(); checkForValidSection();
int64_t NumBytes; int64_t NumBytes;
if (ParseAbsoluteExpression(NumBytes)) if (parseAbsoluteExpression(NumBytes))
return true; return true;
int64_t FillExpr = 0; int64_t FillExpr = 0;
@ -3289,7 +3289,7 @@ bool AsmParser::ParseDirectiveSpace(StringRef IDVal) {
return TokError("unexpected token in '" + Twine(IDVal) + "' directive"); return TokError("unexpected token in '" + Twine(IDVal) + "' directive");
Lex(); Lex();
if (ParseAbsoluteExpression(FillExpr)) if (parseAbsoluteExpression(FillExpr))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -3311,10 +3311,10 @@ bool AsmParser::ParseDirectiveSpace(StringRef IDVal) {
/// ParseDirectiveLEB128 /// ParseDirectiveLEB128
/// ::= (.sleb128 | .uleb128) expression /// ::= (.sleb128 | .uleb128) expression
bool AsmParser::ParseDirectiveLEB128(bool Signed) { bool AsmParser::ParseDirectiveLEB128(bool Signed) {
CheckForValidSection(); checkForValidSection();
const MCExpr *Value; const MCExpr *Value;
if (ParseExpression(Value)) if (parseExpression(Value))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -3336,7 +3336,7 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCSymbolAttr Attr) {
StringRef Name; StringRef Name;
SMLoc Loc = getTok().getLoc(); SMLoc Loc = getTok().getLoc();
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return Error(Loc, "expected identifier in directive"); return Error(Loc, "expected identifier in directive");
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
@ -3363,11 +3363,11 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCSymbolAttr Attr) {
/// ParseDirectiveComm /// ParseDirectiveComm
/// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ] /// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ]
bool AsmParser::ParseDirectiveComm(bool IsLocal) { bool AsmParser::ParseDirectiveComm(bool IsLocal) {
CheckForValidSection(); checkForValidSection();
SMLoc IDLoc = getLexer().getLoc(); SMLoc IDLoc = getLexer().getLoc();
StringRef Name; StringRef Name;
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
// Handle the identifier as the key symbol. // Handle the identifier as the key symbol.
@ -3379,7 +3379,7 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) {
int64_t Size; int64_t Size;
SMLoc SizeLoc = getLexer().getLoc(); SMLoc SizeLoc = getLexer().getLoc();
if (ParseAbsoluteExpression(Size)) if (parseAbsoluteExpression(Size))
return true; return true;
int64_t Pow2Alignment = 0; int64_t Pow2Alignment = 0;
@ -3387,7 +3387,7 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) {
if (getLexer().is(AsmToken::Comma)) { if (getLexer().is(AsmToken::Comma)) {
Lex(); Lex();
Pow2AlignmentLoc = getLexer().getLoc(); Pow2AlignmentLoc = getLexer().getLoc();
if (ParseAbsoluteExpression(Pow2Alignment)) if (parseAbsoluteExpression(Pow2Alignment))
return true; return true;
LCOMM::LCOMMType LCOMM = Lexer.getMAI().getLCOMMDirectiveAlignmentType(); LCOMM::LCOMMType LCOMM = Lexer.getMAI().getLCOMMDirectiveAlignmentType();
@ -3440,7 +3440,7 @@ bool AsmParser::ParseDirectiveAbort() {
// FIXME: Use loc from directive. // FIXME: Use loc from directive.
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
StringRef Str = ParseStringToEndOfStatement(); StringRef Str = parseStringToEndOfStatement();
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.abort' directive"); return TokError("unexpected token in '.abort' directive");
@ -3512,10 +3512,10 @@ bool AsmParser::ParseDirectiveIf(SMLoc DirectiveLoc) {
TheCondStack.push_back(TheCondState); TheCondStack.push_back(TheCondState);
TheCondState.TheCond = AsmCond::IfCond; TheCondState.TheCond = AsmCond::IfCond;
if (TheCondState.Ignore) { if (TheCondState.Ignore) {
EatToEndOfStatement(); eatToEndOfStatement();
} else { } else {
int64_t ExprValue; int64_t ExprValue;
if (ParseAbsoluteExpression(ExprValue)) if (parseAbsoluteExpression(ExprValue))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -3537,9 +3537,9 @@ bool AsmParser::ParseDirectiveIfb(SMLoc DirectiveLoc, bool ExpectBlank) {
TheCondState.TheCond = AsmCond::IfCond; TheCondState.TheCond = AsmCond::IfCond;
if (TheCondState.Ignore) { if (TheCondState.Ignore) {
EatToEndOfStatement(); eatToEndOfStatement();
} else { } else {
StringRef Str = ParseStringToEndOfStatement(); StringRef Str = parseStringToEndOfStatement();
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.ifb' directive"); return TokError("unexpected token in '.ifb' directive");
@ -3560,7 +3560,7 @@ bool AsmParser::ParseDirectiveIfc(SMLoc DirectiveLoc, bool ExpectEqual) {
TheCondState.TheCond = AsmCond::IfCond; TheCondState.TheCond = AsmCond::IfCond;
if (TheCondState.Ignore) { if (TheCondState.Ignore) {
EatToEndOfStatement(); eatToEndOfStatement();
} else { } else {
StringRef Str1 = ParseStringToComma(); StringRef Str1 = ParseStringToComma();
@ -3569,7 +3569,7 @@ bool AsmParser::ParseDirectiveIfc(SMLoc DirectiveLoc, bool ExpectEqual) {
Lex(); Lex();
StringRef Str2 = ParseStringToEndOfStatement(); StringRef Str2 = parseStringToEndOfStatement();
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.ifc' directive"); return TokError("unexpected token in '.ifc' directive");
@ -3591,9 +3591,9 @@ bool AsmParser::ParseDirectiveIfdef(SMLoc DirectiveLoc, bool expect_defined) {
TheCondState.TheCond = AsmCond::IfCond; TheCondState.TheCond = AsmCond::IfCond;
if (TheCondState.Ignore) { if (TheCondState.Ignore) {
EatToEndOfStatement(); eatToEndOfStatement();
} else { } else {
if (ParseIdentifier(Name)) if (parseIdentifier(Name))
return TokError("expected identifier after '.ifdef'"); return TokError("expected identifier after '.ifdef'");
Lex(); Lex();
@ -3624,11 +3624,11 @@ bool AsmParser::ParseDirectiveElseIf(SMLoc DirectiveLoc) {
LastIgnoreState = TheCondStack.back().Ignore; LastIgnoreState = TheCondStack.back().Ignore;
if (LastIgnoreState || TheCondState.CondMet) { if (LastIgnoreState || TheCondState.CondMet) {
TheCondState.Ignore = true; TheCondState.Ignore = true;
EatToEndOfStatement(); eatToEndOfStatement();
} }
else { else {
int64_t ExprValue; int64_t ExprValue;
if (ParseAbsoluteExpression(ExprValue)) if (parseAbsoluteExpression(ExprValue))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -3822,7 +3822,7 @@ MCAsmMacro *AsmParser::ParseMacroLikeBody(SMLoc DirectiveLoc) {
} }
// Otherwise, scan till the end of the statement. // Otherwise, scan till the end of the statement.
EatToEndOfStatement(); eatToEndOfStatement();
} }
const char *BodyStart = StartToken.getLoc().getPointer(); const char *BodyStart = StartToken.getLoc().getPointer();
@ -3858,7 +3858,7 @@ void AsmParser::InstantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc,
bool AsmParser::ParseDirectiveRept(SMLoc DirectiveLoc) { bool AsmParser::ParseDirectiveRept(SMLoc DirectiveLoc) {
int64_t Count; int64_t Count;
if (ParseAbsoluteExpression(Count)) if (parseAbsoluteExpression(Count))
return TokError("unexpected token in '.rept' directive"); return TokError("unexpected token in '.rept' directive");
if (Count < 0) if (Count < 0)
@ -3896,7 +3896,7 @@ bool AsmParser::ParseDirectiveIrp(SMLoc DirectiveLoc) {
MCAsmMacroParameters Parameters; MCAsmMacroParameters Parameters;
MCAsmMacroParameter Parameter; MCAsmMacroParameter Parameter;
if (ParseIdentifier(Parameter.first)) if (parseIdentifier(Parameter.first))
return TokError("expected identifier in '.irp' directive"); return TokError("expected identifier in '.irp' directive");
Parameters.push_back(Parameter); Parameters.push_back(Parameter);
@ -3942,7 +3942,7 @@ bool AsmParser::ParseDirectiveIrpc(SMLoc DirectiveLoc) {
MCAsmMacroParameters Parameters; MCAsmMacroParameters Parameters;
MCAsmMacroParameter Parameter; MCAsmMacroParameter Parameter;
if (ParseIdentifier(Parameter.first)) if (parseIdentifier(Parameter.first))
return TokError("expected identifier in '.irpc' directive"); return TokError("expected identifier in '.irpc' directive");
Parameters.push_back(Parameter); Parameters.push_back(Parameter);
@ -4006,7 +4006,7 @@ bool AsmParser::ParseDirectiveMSEmit(SMLoc IDLoc, ParseStatementInfo &Info,
size_t Len) { size_t Len) {
const MCExpr *Value; const MCExpr *Value;
SMLoc ExprLoc = getLexer().getLoc(); SMLoc ExprLoc = getLexer().getLoc();
if (ParseExpression(Value)) if (parseExpression(Value))
return true; return true;
const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value); const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value);
if (!MCE) if (!MCE)
@ -4022,7 +4022,7 @@ bool AsmParser::ParseDirectiveMSEmit(SMLoc IDLoc, ParseStatementInfo &Info,
bool AsmParser::ParseDirectiveMSAlign(SMLoc IDLoc, ParseStatementInfo &Info) { bool AsmParser::ParseDirectiveMSAlign(SMLoc IDLoc, ParseStatementInfo &Info) {
const MCExpr *Value; const MCExpr *Value;
SMLoc ExprLoc = getLexer().getLoc(); SMLoc ExprLoc = getLexer().getLoc();
if (ParseExpression(Value)) if (parseExpression(Value))
return true; return true;
const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value); const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value);
if (!MCE) if (!MCE)
@ -4063,7 +4063,7 @@ static int RewritesSort(const void *A, const void *B) {
} }
bool bool
AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, AsmParser::parseMSInlineAsm(void *AsmLoc, std::string &AsmString,
unsigned &NumOutputs, unsigned &NumInputs, unsigned &NumOutputs, unsigned &NumInputs,
SmallVectorImpl<std::pair<void *, bool> > &OpDecls, SmallVectorImpl<std::pair<void *, bool> > &OpDecls,
SmallVectorImpl<std::string> &Constraints, SmallVectorImpl<std::string> &Constraints,

View File

@ -25,10 +25,10 @@ namespace {
class COFFAsmParser : public MCAsmParserExtension { class COFFAsmParser : public MCAsmParserExtension {
template<bool (COFFAsmParser::*HandlerMethod)(StringRef, SMLoc)> template<bool (COFFAsmParser::*HandlerMethod)(StringRef, SMLoc)>
void AddDirectiveHandler(StringRef Directive) { void addDirectiveHandler(StringRef Directive) {
MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
this, HandleDirective<COFFAsmParser, HandlerMethod>); this, HandleDirective<COFFAsmParser, HandlerMethod>);
getParser().AddDirectiveHandler(Directive, Handler); getParser().addDirectiveHandler(Directive, Handler);
} }
bool ParseSectionSwitch(StringRef Section, bool ParseSectionSwitch(StringRef Section,
@ -39,43 +39,43 @@ class COFFAsmParser : public MCAsmParserExtension {
// Call the base implementation. // Call the base implementation.
MCAsmParserExtension::Initialize(Parser); MCAsmParserExtension::Initialize(Parser);
AddDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveText>(".text"); addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveText>(".text");
AddDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveData>(".data"); addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveData>(".data");
AddDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveBSS>(".bss"); addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveBSS>(".bss");
AddDirectiveHandler<&COFFAsmParser::ParseDirectiveDef>(".def"); addDirectiveHandler<&COFFAsmParser::ParseDirectiveDef>(".def");
AddDirectiveHandler<&COFFAsmParser::ParseDirectiveScl>(".scl"); addDirectiveHandler<&COFFAsmParser::ParseDirectiveScl>(".scl");
AddDirectiveHandler<&COFFAsmParser::ParseDirectiveType>(".type"); addDirectiveHandler<&COFFAsmParser::ParseDirectiveType>(".type");
AddDirectiveHandler<&COFFAsmParser::ParseDirectiveEndef>(".endef"); addDirectiveHandler<&COFFAsmParser::ParseDirectiveEndef>(".endef");
AddDirectiveHandler<&COFFAsmParser::ParseDirectiveSecRel32>(".secrel32"); addDirectiveHandler<&COFFAsmParser::ParseDirectiveSecRel32>(".secrel32");
// Win64 EH directives. // Win64 EH directives.
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartProc>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartProc>(
".seh_proc"); ".seh_proc");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProc>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProc>(
".seh_endproc"); ".seh_endproc");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartChained>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartChained>(
".seh_startchained"); ".seh_startchained");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndChained>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndChained>(
".seh_endchained"); ".seh_endchained");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandler>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandler>(
".seh_handler"); ".seh_handler");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandlerData>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandlerData>(
".seh_handlerdata"); ".seh_handlerdata");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushReg>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushReg>(
".seh_pushreg"); ".seh_pushreg");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSetFrame>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSetFrame>(
".seh_setframe"); ".seh_setframe");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveAllocStack>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveAllocStack>(
".seh_stackalloc"); ".seh_stackalloc");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveReg>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveReg>(
".seh_savereg"); ".seh_savereg");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveXMM>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveXMM>(
".seh_savexmm"); ".seh_savexmm");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushFrame>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushFrame>(
".seh_pushframe"); ".seh_pushframe");
AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProlog>( addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProlog>(
".seh_endprologue"); ".seh_endprologue");
AddDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(".weak"); addDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(".weak");
} }
bool ParseSectionDirectiveText(StringRef, SMLoc) { bool ParseSectionDirectiveText(StringRef, SMLoc) {
@ -141,7 +141,7 @@ bool COFFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
for (;;) { for (;;) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
@ -177,7 +177,7 @@ bool COFFAsmParser::ParseSectionSwitch(StringRef Section,
bool COFFAsmParser::ParseDirectiveDef(StringRef, SMLoc) { bool COFFAsmParser::ParseDirectiveDef(StringRef, SMLoc) {
StringRef SymbolName; StringRef SymbolName;
if (getParser().ParseIdentifier(SymbolName)) if (getParser().parseIdentifier(SymbolName))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Sym = getContext().GetOrCreateSymbol(SymbolName); MCSymbol *Sym = getContext().GetOrCreateSymbol(SymbolName);
@ -190,7 +190,7 @@ bool COFFAsmParser::ParseDirectiveDef(StringRef, SMLoc) {
bool COFFAsmParser::ParseDirectiveScl(StringRef, SMLoc) { bool COFFAsmParser::ParseDirectiveScl(StringRef, SMLoc) {
int64_t SymbolStorageClass; int64_t SymbolStorageClass;
if (getParser().ParseAbsoluteExpression(SymbolStorageClass)) if (getParser().parseAbsoluteExpression(SymbolStorageClass))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -203,7 +203,7 @@ bool COFFAsmParser::ParseDirectiveScl(StringRef, SMLoc) {
bool COFFAsmParser::ParseDirectiveType(StringRef, SMLoc) { bool COFFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
int64_t Type; int64_t Type;
if (getParser().ParseAbsoluteExpression(Type)) if (getParser().parseAbsoluteExpression(Type))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -222,7 +222,7 @@ bool COFFAsmParser::ParseDirectiveEndef(StringRef, SMLoc) {
bool COFFAsmParser::ParseDirectiveSecRel32(StringRef, SMLoc) { bool COFFAsmParser::ParseDirectiveSecRel32(StringRef, SMLoc) {
StringRef SymbolID; StringRef SymbolID;
if (getParser().ParseIdentifier(SymbolID)) if (getParser().parseIdentifier(SymbolID))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -237,7 +237,7 @@ bool COFFAsmParser::ParseDirectiveSecRel32(StringRef, SMLoc) {
bool COFFAsmParser::ParseSEHDirectiveStartProc(StringRef, SMLoc) { bool COFFAsmParser::ParseSEHDirectiveStartProc(StringRef, SMLoc) {
StringRef SymbolID; StringRef SymbolID;
if (getParser().ParseIdentifier(SymbolID)) if (getParser().parseIdentifier(SymbolID))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -270,7 +270,7 @@ bool COFFAsmParser::ParseSEHDirectiveEndChained(StringRef, SMLoc) {
bool COFFAsmParser::ParseSEHDirectiveHandler(StringRef, SMLoc) { bool COFFAsmParser::ParseSEHDirectiveHandler(StringRef, SMLoc) {
StringRef SymbolID; StringRef SymbolID;
if (getParser().ParseIdentifier(SymbolID)) if (getParser().parseIdentifier(SymbolID))
return true; return true;
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
@ -323,7 +323,7 @@ bool COFFAsmParser::ParseSEHDirectiveSetFrame(StringRef, SMLoc L) {
Lex(); Lex();
SMLoc startLoc = getLexer().getLoc(); SMLoc startLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Off)) if (getParser().parseAbsoluteExpression(Off))
return true; return true;
if (Off & 0x0F) if (Off & 0x0F)
@ -340,7 +340,7 @@ bool COFFAsmParser::ParseSEHDirectiveSetFrame(StringRef, SMLoc L) {
bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc) { bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc) {
int64_t Size; int64_t Size;
SMLoc startLoc = getLexer().getLoc(); SMLoc startLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Size)) if (getParser().parseAbsoluteExpression(Size))
return true; return true;
if (Size & 7) if (Size & 7)
@ -364,7 +364,7 @@ bool COFFAsmParser::ParseSEHDirectiveSaveReg(StringRef, SMLoc L) {
Lex(); Lex();
SMLoc startLoc = getLexer().getLoc(); SMLoc startLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Off)) if (getParser().parseAbsoluteExpression(Off))
return true; return true;
if (Off & 7) if (Off & 7)
@ -391,7 +391,7 @@ bool COFFAsmParser::ParseSEHDirectiveSaveXMM(StringRef, SMLoc L) {
Lex(); Lex();
SMLoc startLoc = getLexer().getLoc(); SMLoc startLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Off)) if (getParser().parseAbsoluteExpression(Off))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -412,7 +412,7 @@ bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc) {
if (getLexer().is(AsmToken::At)) { if (getLexer().is(AsmToken::At)) {
SMLoc startLoc = getLexer().getLoc(); SMLoc startLoc = getLexer().getLoc();
Lex(); Lex();
if (!getParser().ParseIdentifier(CodeID)) { if (!getParser().parseIdentifier(CodeID)) {
if (CodeID != "code") if (CodeID != "code")
return Error(startLoc, "expected @code"); return Error(startLoc, "expected @code");
Code = true; Code = true;
@ -439,7 +439,7 @@ bool COFFAsmParser::ParseAtUnwindOrAtExcept(bool &unwind, bool &except) {
return TokError("a handler attribute must begin with '@'"); return TokError("a handler attribute must begin with '@'");
SMLoc startLoc = getLexer().getLoc(); SMLoc startLoc = getLexer().getLoc();
Lex(); Lex();
if (getParser().ParseIdentifier(identifier)) if (getParser().parseIdentifier(identifier))
return Error(startLoc, "expected @unwind or @except"); return Error(startLoc, "expected @unwind or @except");
if (identifier == "unwind") if (identifier == "unwind")
unwind = true; unwind = true;
@ -480,7 +480,7 @@ bool COFFAsmParser::ParseSEHRegisterNumber(unsigned &RegNo) {
} }
else { else {
int64_t n; int64_t n;
if (getParser().ParseAbsoluteExpression(n)) if (getParser().parseAbsoluteExpression(n))
return true; return true;
if (n > 15) if (n > 15)
return Error(startLoc, "register number is too high"); return Error(startLoc, "register number is too high");

View File

@ -27,10 +27,10 @@ namespace {
/// Darwin targets. /// Darwin targets.
class DarwinAsmParser : public MCAsmParserExtension { class DarwinAsmParser : public MCAsmParserExtension {
template<bool (DarwinAsmParser::*HandlerMethod)(StringRef, SMLoc)> template<bool (DarwinAsmParser::*HandlerMethod)(StringRef, SMLoc)>
void AddDirectiveHandler(StringRef Directive) { void addDirectiveHandler(StringRef Directive) {
MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
this, HandleDirective<DarwinAsmParser, HandlerMethod>); this, HandleDirective<DarwinAsmParser, HandlerMethod>);
getParser().AddDirectiveHandler(Directive, Handler); getParser().addDirectiveHandler(Directive, Handler);
} }
bool ParseSectionSwitch(const char *Segment, const char *Section, bool ParseSectionSwitch(const char *Segment, const char *Section,
@ -44,122 +44,122 @@ public:
// Call the base implementation. // Call the base implementation.
this->MCAsmParserExtension::Initialize(Parser); this->MCAsmParserExtension::Initialize(Parser);
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDesc>(".desc"); addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDesc>(".desc");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveLsym>(".lsym"); addDirectiveHandler<&DarwinAsmParser::ParseDirectiveLsym>(".lsym");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSubsectionsViaSymbols>( addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSubsectionsViaSymbols>(
".subsections_via_symbols"); ".subsections_via_symbols");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".dump"); addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".dump");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".load"); addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".load");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSection>(".section"); addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSection>(".section");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectivePushSection>( addDirectiveHandler<&DarwinAsmParser::ParseDirectivePushSection>(
".pushsection"); ".pushsection");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectivePopSection>( addDirectiveHandler<&DarwinAsmParser::ParseDirectivePopSection>(
".popsection"); ".popsection");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectivePrevious>(".previous"); addDirectiveHandler<&DarwinAsmParser::ParseDirectivePrevious>(".previous");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogUnique>( addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogUnique>(
".secure_log_unique"); ".secure_log_unique");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogReset>( addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogReset>(
".secure_log_reset"); ".secure_log_reset");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveTBSS>(".tbss"); addDirectiveHandler<&DarwinAsmParser::ParseDirectiveTBSS>(".tbss");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveZerofill>(".zerofill"); addDirectiveHandler<&DarwinAsmParser::ParseDirectiveZerofill>(".zerofill");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegion>( addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegion>(
".data_region"); ".data_region");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegionEnd>( addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegionEnd>(
".end_data_region"); ".end_data_region");
// Special section directives. // Special section directives.
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConst>(".const"); addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConst>(".const");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstData>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstData>(
".const_data"); ".const_data");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstructor>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstructor>(
".constructor"); ".constructor");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveCString>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveCString>(
".cstring"); ".cstring");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveData>(".data"); addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveData>(".data");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDestructor>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDestructor>(
".destructor"); ".destructor");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDyld>(".dyld"); addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDyld>(".dyld");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit0>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit0>(
".fvmlib_init0"); ".fvmlib_init0");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit1>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit1>(
".fvmlib_init1"); ".fvmlib_init1");
AddDirectiveHandler< addDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveLazySymbolPointers>( &DarwinAsmParser::ParseSectionDirectiveLazySymbolPointers>(
".lazy_symbol_pointer"); ".lazy_symbol_pointer");
AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveLinkerOption>( addDirectiveHandler<&DarwinAsmParser::ParseDirectiveLinkerOption>(
".linker_option"); ".linker_option");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral16>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral16>(
".literal16"); ".literal16");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral4>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral4>(
".literal4"); ".literal4");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral8>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral8>(
".literal8"); ".literal8");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModInitFunc>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModInitFunc>(
".mod_init_func"); ".mod_init_func");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModTermFunc>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModTermFunc>(
".mod_term_func"); ".mod_term_func");
AddDirectiveHandler< addDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveNonLazySymbolPointers>( &DarwinAsmParser::ParseSectionDirectiveNonLazySymbolPointers>(
".non_lazy_symbol_pointer"); ".non_lazy_symbol_pointer");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatClsMeth>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatClsMeth>(
".objc_cat_cls_meth"); ".objc_cat_cls_meth");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatInstMeth>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatInstMeth>(
".objc_cat_inst_meth"); ".objc_cat_inst_meth");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCategory>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCategory>(
".objc_category"); ".objc_category");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClass>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClass>(
".objc_class"); ".objc_class");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassNames>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassNames>(
".objc_class_names"); ".objc_class_names");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassVars>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassVars>(
".objc_class_vars"); ".objc_class_vars");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsMeth>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsMeth>(
".objc_cls_meth"); ".objc_cls_meth");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsRefs>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsRefs>(
".objc_cls_refs"); ".objc_cls_refs");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCInstMeth>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCInstMeth>(
".objc_inst_meth"); ".objc_inst_meth");
AddDirectiveHandler< addDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveObjCInstanceVars>( &DarwinAsmParser::ParseSectionDirectiveObjCInstanceVars>(
".objc_instance_vars"); ".objc_instance_vars");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMessageRefs>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMessageRefs>(
".objc_message_refs"); ".objc_message_refs");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMetaClass>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMetaClass>(
".objc_meta_class"); ".objc_meta_class");
AddDirectiveHandler< addDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveObjCMethVarNames>( &DarwinAsmParser::ParseSectionDirectiveObjCMethVarNames>(
".objc_meth_var_names"); ".objc_meth_var_names");
AddDirectiveHandler< addDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveObjCMethVarTypes>( &DarwinAsmParser::ParseSectionDirectiveObjCMethVarTypes>(
".objc_meth_var_types"); ".objc_meth_var_types");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCModuleInfo>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCModuleInfo>(
".objc_module_info"); ".objc_module_info");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCProtocol>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCProtocol>(
".objc_protocol"); ".objc_protocol");
AddDirectiveHandler< addDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveObjCSelectorStrs>( &DarwinAsmParser::ParseSectionDirectiveObjCSelectorStrs>(
".objc_selector_strs"); ".objc_selector_strs");
AddDirectiveHandler< addDirectiveHandler<
&DarwinAsmParser::ParseSectionDirectiveObjCStringObject>( &DarwinAsmParser::ParseSectionDirectiveObjCStringObject>(
".objc_string_object"); ".objc_string_object");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCSymbols>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCSymbols>(
".objc_symbols"); ".objc_symbols");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectivePICSymbolStub>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectivePICSymbolStub>(
".picsymbol_stub"); ".picsymbol_stub");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticConst>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticConst>(
".static_const"); ".static_const");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticData>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticData>(
".static_data"); ".static_data");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveSymbolStub>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveSymbolStub>(
".symbol_stub"); ".symbol_stub");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTData>(".tdata"); addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTData>(".tdata");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveText>(".text"); addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveText>(".text");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveThreadInitFunc>( addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveThreadInitFunc>(
".thread_init_func"); ".thread_init_func");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTLV>(".tlv"); addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTLV>(".tlv");
AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveIdent>(".ident"); addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveIdent>(".ident");
} }
bool ParseDirectiveDesc(StringRef, SMLoc); bool ParseDirectiveDesc(StringRef, SMLoc);
@ -345,7 +345,7 @@ public:
} }
bool ParseSectionDirectiveIdent(StringRef, SMLoc) { bool ParseSectionDirectiveIdent(StringRef, SMLoc) {
// Darwin silently ignores the .ident directive. // Darwin silently ignores the .ident directive.
getParser().EatToEndOfStatement(); getParser().eatToEndOfStatement();
return false; return false;
} }
bool ParseSectionDirectiveThreadInitFunc(StringRef, SMLoc) { bool ParseSectionDirectiveThreadInitFunc(StringRef, SMLoc) {
@ -390,7 +390,7 @@ bool DarwinAsmParser::ParseSectionSwitch(const char *Segment,
/// ::= .desc identifier , expression /// ::= .desc identifier , expression
bool DarwinAsmParser::ParseDirectiveDesc(StringRef, SMLoc) { bool DarwinAsmParser::ParseDirectiveDesc(StringRef, SMLoc) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
// Handle the identifier as the key symbol. // Handle the identifier as the key symbol.
@ -401,7 +401,7 @@ bool DarwinAsmParser::ParseDirectiveDesc(StringRef, SMLoc) {
Lex(); Lex();
int64_t DescValue; int64_t DescValue;
if (getParser().ParseAbsoluteExpression(DescValue)) if (getParser().parseAbsoluteExpression(DescValue))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -447,7 +447,7 @@ bool DarwinAsmParser::ParseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
return TokError("expected string in '" + Twine(IDVal) + "' directive"); return TokError("expected string in '" + Twine(IDVal) + "' directive");
std::string Data; std::string Data;
if (getParser().ParseEscapedString(Data)) if (getParser().parseEscapedString(Data))
return true; return true;
Args.push_back(Data); Args.push_back(Data);
@ -469,7 +469,7 @@ bool DarwinAsmParser::ParseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
/// ::= .lsym identifier , expression /// ::= .lsym identifier , expression
bool DarwinAsmParser::ParseDirectiveLsym(StringRef, SMLoc) { bool DarwinAsmParser::ParseDirectiveLsym(StringRef, SMLoc) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
// Handle the identifier as the key symbol. // Handle the identifier as the key symbol.
@ -480,7 +480,7 @@ bool DarwinAsmParser::ParseDirectiveLsym(StringRef, SMLoc) {
Lex(); Lex();
const MCExpr *Value; const MCExpr *Value;
if (getParser().ParseExpression(Value)) if (getParser().parseExpression(Value))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -501,7 +501,7 @@ bool DarwinAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
StringRef SectionName; StringRef SectionName;
if (getParser().ParseIdentifier(SectionName)) if (getParser().parseIdentifier(SectionName))
return Error(Loc, "expected identifier after '.section' directive"); return Error(Loc, "expected identifier after '.section' directive");
// Verify there is a following comma. // Verify there is a following comma.
@ -576,7 +576,7 @@ bool DarwinAsmParser::ParseDirectivePrevious(StringRef DirName, SMLoc) {
/// ParseDirectiveSecureLogUnique /// ParseDirectiveSecureLogUnique
/// ::= .secure_log_unique ... message ... /// ::= .secure_log_unique ... message ...
bool DarwinAsmParser::ParseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) { bool DarwinAsmParser::ParseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
StringRef LogMessage = getParser().ParseStringToEndOfStatement(); StringRef LogMessage = getParser().parseStringToEndOfStatement();
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.secure_log_unique' directive"); return TokError("unexpected token in '.secure_log_unique' directive");
@ -644,7 +644,7 @@ bool DarwinAsmParser::ParseDirectiveSubsectionsViaSymbols(StringRef, SMLoc) {
bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) { bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) {
SMLoc IDLoc = getLexer().getLoc(); SMLoc IDLoc = getLexer().getLoc();
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
// Handle the identifier as the key symbol. // Handle the identifier as the key symbol.
@ -656,7 +656,7 @@ bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) {
int64_t Size; int64_t Size;
SMLoc SizeLoc = getLexer().getLoc(); SMLoc SizeLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Size)) if (getParser().parseAbsoluteExpression(Size))
return true; return true;
int64_t Pow2Alignment = 0; int64_t Pow2Alignment = 0;
@ -664,7 +664,7 @@ bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) {
if (getLexer().is(AsmToken::Comma)) { if (getLexer().is(AsmToken::Comma)) {
Lex(); Lex();
Pow2AlignmentLoc = getLexer().getLoc(); Pow2AlignmentLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Pow2Alignment)) if (getParser().parseAbsoluteExpression(Pow2Alignment))
return true; return true;
} }
@ -699,7 +699,7 @@ bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) {
/// , align_expression ]] /// , align_expression ]]
bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) { bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) {
StringRef Segment; StringRef Segment;
if (getParser().ParseIdentifier(Segment)) if (getParser().parseIdentifier(Segment))
return TokError("expected segment name after '.zerofill' directive"); return TokError("expected segment name after '.zerofill' directive");
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
@ -707,7 +707,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) {
Lex(); Lex();
StringRef Section; StringRef Section;
if (getParser().ParseIdentifier(Section)) if (getParser().parseIdentifier(Section))
return TokError("expected section name after comma in '.zerofill' " return TokError("expected section name after comma in '.zerofill' "
"directive"); "directive");
@ -727,7 +727,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) {
SMLoc IDLoc = getLexer().getLoc(); SMLoc IDLoc = getLexer().getLoc();
StringRef IDStr; StringRef IDStr;
if (getParser().ParseIdentifier(IDStr)) if (getParser().parseIdentifier(IDStr))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
// handle the identifier as the key symbol. // handle the identifier as the key symbol.
@ -739,7 +739,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) {
int64_t Size; int64_t Size;
SMLoc SizeLoc = getLexer().getLoc(); SMLoc SizeLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Size)) if (getParser().parseAbsoluteExpression(Size))
return true; return true;
int64_t Pow2Alignment = 0; int64_t Pow2Alignment = 0;
@ -747,7 +747,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) {
if (getLexer().is(AsmToken::Comma)) { if (getLexer().is(AsmToken::Comma)) {
Lex(); Lex();
Pow2AlignmentLoc = getLexer().getLoc(); Pow2AlignmentLoc = getLexer().getLoc();
if (getParser().ParseAbsoluteExpression(Pow2Alignment)) if (getParser().parseAbsoluteExpression(Pow2Alignment))
return true; return true;
} }
@ -791,7 +791,7 @@ bool DarwinAsmParser::ParseDirectiveDataRegion(StringRef, SMLoc) {
} }
StringRef RegionType; StringRef RegionType;
SMLoc Loc = getParser().getTok().getLoc(); SMLoc Loc = getParser().getTok().getLoc();
if (getParser().ParseIdentifier(RegionType)) if (getParser().parseIdentifier(RegionType))
return TokError("expected region type after '.data_region' directive"); return TokError("expected region type after '.data_region' directive");
int Kind = StringSwitch<int>(RegionType) int Kind = StringSwitch<int>(RegionType)
.Case("jt8", MCDR_DataRegionJT8) .Case("jt8", MCDR_DataRegionJT8)

View File

@ -23,11 +23,11 @@ namespace {
class ELFAsmParser : public MCAsmParserExtension { class ELFAsmParser : public MCAsmParserExtension {
template<bool (ELFAsmParser::*HandlerMethod)(StringRef, SMLoc)> template<bool (ELFAsmParser::*HandlerMethod)(StringRef, SMLoc)>
void AddDirectiveHandler(StringRef Directive) { void addDirectiveHandler(StringRef Directive) {
MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair(
this, HandleDirective<ELFAsmParser, HandlerMethod>); this, HandleDirective<ELFAsmParser, HandlerMethod>);
getParser().AddDirectiveHandler(Directive, Handler); getParser().addDirectiveHandler(Directive, Handler);
} }
bool ParseSectionSwitch(StringRef Section, unsigned Type, bool ParseSectionSwitch(StringRef Section, unsigned Type,
@ -43,38 +43,38 @@ public:
// Call the base implementation. // Call the base implementation.
this->MCAsmParserExtension::Initialize(Parser); this->MCAsmParserExtension::Initialize(Parser);
AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveData>(".data"); addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveData>(".data");
AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveText>(".text"); addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveText>(".text");
AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveBSS>(".bss"); addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveBSS>(".bss");
AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveRoData>(".rodata"); addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveRoData>(".rodata");
AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTData>(".tdata"); addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTData>(".tdata");
AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTBSS>(".tbss"); addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTBSS>(".tbss");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseSectionDirectiveDataRel>(".data.rel"); &ELFAsmParser::ParseSectionDirectiveDataRel>(".data.rel");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseSectionDirectiveDataRelRo>(".data.rel.ro"); &ELFAsmParser::ParseSectionDirectiveDataRelRo>(".data.rel.ro");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseSectionDirectiveDataRelRoLocal>(".data.rel.ro.local"); &ELFAsmParser::ParseSectionDirectiveDataRelRoLocal>(".data.rel.ro.local");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseSectionDirectiveEhFrame>(".eh_frame"); &ELFAsmParser::ParseSectionDirectiveEhFrame>(".eh_frame");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSection>(".section"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveSection>(".section");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseDirectivePushSection>(".pushsection"); &ELFAsmParser::ParseDirectivePushSection>(".pushsection");
AddDirectiveHandler<&ELFAsmParser::ParseDirectivePopSection>(".popsection"); addDirectiveHandler<&ELFAsmParser::ParseDirectivePopSection>(".popsection");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSize>(".size"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveSize>(".size");
AddDirectiveHandler<&ELFAsmParser::ParseDirectivePrevious>(".previous"); addDirectiveHandler<&ELFAsmParser::ParseDirectivePrevious>(".previous");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveType>(".type"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveType>(".type");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveIdent>(".ident"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveIdent>(".ident");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSymver>(".symver"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymver>(".symver");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveVersion>(".version"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveVersion>(".version");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveWeakref>(".weakref"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveWeakref>(".weakref");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".weak"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".weak");
AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".local"); addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".local");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseDirectiveSymbolAttribute>(".protected"); &ELFAsmParser::ParseDirectiveSymbolAttribute>(".protected");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseDirectiveSymbolAttribute>(".internal"); &ELFAsmParser::ParseDirectiveSymbolAttribute>(".internal");
AddDirectiveHandler< addDirectiveHandler<
&ELFAsmParser::ParseDirectiveSymbolAttribute>(".hidden"); &ELFAsmParser::ParseDirectiveSymbolAttribute>(".hidden");
} }
@ -169,7 +169,7 @@ bool ELFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
for (;;) { for (;;) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
@ -203,7 +203,7 @@ bool ELFAsmParser::ParseSectionSwitch(StringRef Section, unsigned Type,
bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) { bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
@ -212,7 +212,7 @@ bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) {
Lex(); Lex();
const MCExpr *Expr; const MCExpr *Expr;
if (getParser().ParseExpression(Expr)) if (getParser().parseExpression(Expr))
return true; return true;
if (getLexer().isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
@ -224,7 +224,7 @@ bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) {
bool ELFAsmParser::ParseSectionName(StringRef &SectionName) { bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
// A section name can contain -, so we cannot just use // A section name can contain -, so we cannot just use
// ParseIdentifier. // parseIdentifier.
SMLoc FirstLoc = getLexer().getLoc(); SMLoc FirstLoc = getLexer().getLoc();
unsigned Size = 0; unsigned Size = 0;
@ -377,14 +377,14 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
return TokError("expected '@' or '%' before type"); return TokError("expected '@' or '%' before type");
Lex(); Lex();
if (getParser().ParseIdentifier(TypeName)) if (getParser().parseIdentifier(TypeName))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
if (Mergeable) { if (Mergeable) {
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
return TokError("expected the entry size"); return TokError("expected the entry size");
Lex(); Lex();
if (getParser().ParseAbsoluteExpression(Size)) if (getParser().parseAbsoluteExpression(Size))
return true; return true;
if (Size <= 0) if (Size <= 0)
return TokError("entry size must be positive"); return TokError("entry size must be positive");
@ -394,12 +394,12 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
return TokError("expected group name"); return TokError("expected group name");
Lex(); Lex();
if (getParser().ParseIdentifier(GroupName)) if (getParser().parseIdentifier(GroupName))
return true; return true;
if (getLexer().is(AsmToken::Comma)) { if (getLexer().is(AsmToken::Comma)) {
Lex(); Lex();
StringRef Linkage; StringRef Linkage;
if (getParser().ParseIdentifier(Linkage)) if (getParser().parseIdentifier(Linkage))
return true; return true;
if (Linkage != "comdat") if (Linkage != "comdat")
return TokError("Linkage must be 'comdat'"); return TokError("Linkage must be 'comdat'");
@ -461,7 +461,7 @@ bool ELFAsmParser::ParseDirectivePrevious(StringRef DirName, SMLoc) {
/// ::= .type identifier , @attribute /// ::= .type identifier , @attribute
bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) { bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
// Handle the identifier as the key symbol. // Handle the identifier as the key symbol.
@ -479,7 +479,7 @@ bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) {
SMLoc TypeLoc; SMLoc TypeLoc;
TypeLoc = getLexer().getLoc(); TypeLoc = getLexer().getLoc();
if (getParser().ParseIdentifier(Type)) if (getParser().parseIdentifier(Type))
return TokError("expected symbol type in directive"); return TokError("expected symbol type in directive");
MCSymbolAttr Attr = StringSwitch<MCSymbolAttr>(Type) MCSymbolAttr Attr = StringSwitch<MCSymbolAttr>(Type)
@ -538,7 +538,7 @@ bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) {
/// ::= .symver foo, bar2@zed /// ::= .symver foo, bar2@zed
bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) { bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
@ -547,7 +547,7 @@ bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) {
Lex(); Lex();
StringRef AliasName; StringRef AliasName;
if (getParser().ParseIdentifier(AliasName)) if (getParser().parseIdentifier(AliasName))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
if (AliasName.find('@') == StringRef::npos) if (AliasName.find('@') == StringRef::npos)
@ -593,7 +593,7 @@ bool ELFAsmParser::ParseDirectiveWeakref(StringRef, SMLoc) {
// FIXME: Share code with the other alias building directives. // FIXME: Share code with the other alias building directives.
StringRef AliasName; StringRef AliasName;
if (getParser().ParseIdentifier(AliasName)) if (getParser().parseIdentifier(AliasName))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
if (getLexer().isNot(AsmToken::Comma)) if (getLexer().isNot(AsmToken::Comma))
@ -602,7 +602,7 @@ bool ELFAsmParser::ParseDirectiveWeakref(StringRef, SMLoc) {
Lex(); Lex();
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return TokError("expected identifier in directive"); return TokError("expected identifier in directive");
MCSymbol *Alias = getContext().GetOrCreateSymbol(AliasName); MCSymbol *Alias = getContext().GetOrCreateSymbol(AliasName);

View File

@ -38,9 +38,9 @@ bool MCAsmParser::TokError(const Twine &Msg, ArrayRef<SMRange> Ranges) {
return true; return true;
} }
bool MCAsmParser::ParseExpression(const MCExpr *&Res) { bool MCAsmParser::parseExpression(const MCExpr *&Res) {
SMLoc L; SMLoc L;
return ParseExpression(Res, L); return parseExpression(Res, L);
} }
void MCParsedAsmOperand::dump() const { void MCParsedAsmOperand::dump() const {

View File

@ -1155,7 +1155,7 @@ AArch64AsmParser::ParseImmediate(const MCExpr *&ExprVal) {
return ResTy; return ResTy;
const MCExpr *SubExprVal; const MCExpr *SubExprVal;
if (getParser().ParseExpression(SubExprVal)) if (getParser().parseExpression(SubExprVal))
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
ExprVal = AArch64MCExpr::Create(RefKind, SubExprVal, getContext()); ExprVal = AArch64MCExpr::Create(RefKind, SubExprVal, getContext());
@ -1163,7 +1163,7 @@ AArch64AsmParser::ParseImmediate(const MCExpr *&ExprVal) {
} }
// No weird AArch64MCExpr prefix // No weird AArch64MCExpr prefix
return getParser().ParseExpression(ExprVal) return getParser().parseExpression(ExprVal)
? MatchOperand_ParseFail : MatchOperand_Success; ? MatchOperand_ParseFail : MatchOperand_Success;
} }
@ -1823,7 +1823,7 @@ bool AArch64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
if (Code == A64CC::Invalid) { if (Code == A64CC::Invalid) {
Error(S, "invalid condition code"); Error(S, "invalid condition code");
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return true; return true;
} }
@ -1838,7 +1838,7 @@ bool AArch64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
// Read the first operand. // Read the first operand.
if (ParseOperand(Operands, Mnemonic)) { if (ParseOperand(Operands, Mnemonic)) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return true; return true;
} }
@ -1847,7 +1847,7 @@ bool AArch64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
// Parse and remember the operand. // Parse and remember the operand.
if (ParseOperand(Operands, Mnemonic)) { if (ParseOperand(Operands, Mnemonic)) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return true; return true;
} }
@ -1876,7 +1876,7 @@ bool AArch64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "expected comma before next operand"); return Error(Loc, "expected comma before next operand");
} }
@ -1906,7 +1906,7 @@ bool AArch64AsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
for (;;) { for (;;) {
const MCExpr *Value; const MCExpr *Value;
if (getParser().ParseExpression(Value)) if (getParser().parseExpression(Value))
return true; return true;
getParser().getStreamer().EmitValue(Value, Size, 0/*addrspace*/); getParser().getStreamer().EmitValue(Value, Size, 0/*addrspace*/);
@ -1929,7 +1929,7 @@ bool AArch64AsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
// ::= .tlsdesccall symbol // ::= .tlsdesccall symbol
bool AArch64AsmParser::ParseDirectiveTLSDescCall(SMLoc L) { bool AArch64AsmParser::ParseDirectiveTLSDescCall(SMLoc L) {
StringRef Name; StringRef Name;
if (getParser().ParseIdentifier(Name)) if (getParser().parseIdentifier(Name))
return Error(L, "expected symbol after directive"); return Error(L, "expected symbol after directive");
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);

View File

@ -2568,7 +2568,7 @@ int ARMAsmParser::tryParseShiftRegister(
Parser.Lex(); // Eat hash. Parser.Lex(); // Eat hash.
SMLoc ImmLoc = Parser.getTok().getLoc(); SMLoc ImmLoc = Parser.getTok().getLoc();
const MCExpr *ShiftExpr = 0; const MCExpr *ShiftExpr = 0;
if (getParser().ParseExpression(ShiftExpr, EndLoc)) { if (getParser().parseExpression(ShiftExpr, EndLoc)) {
Error(ImmLoc, "invalid immediate shift value"); Error(ImmLoc, "invalid immediate shift value");
return -1; return -1;
} }
@ -2651,7 +2651,7 @@ tryParseRegisterWithWriteBack(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
Parser.Lex(); // Eat left bracket token. Parser.Lex(); // Eat left bracket token.
const MCExpr *ImmVal; const MCExpr *ImmVal;
if (getParser().ParseExpression(ImmVal)) if (getParser().parseExpression(ImmVal))
return true; return true;
const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(ImmVal); const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(ImmVal);
if (!MCE) if (!MCE)
@ -2796,7 +2796,7 @@ parseCoprocOptionOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
const MCExpr *Expr; const MCExpr *Expr;
SMLoc Loc = Parser.getTok().getLoc(); SMLoc Loc = Parser.getTok().getLoc();
if (getParser().ParseExpression(Expr)) { if (getParser().parseExpression(Expr)) {
Error(Loc, "illegal expression"); Error(Loc, "illegal expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3009,7 +3009,7 @@ parseVectorLane(VectorLaneTy &LaneKind, unsigned &Index, SMLoc &EndLoc) {
const MCExpr *LaneIndex; const MCExpr *LaneIndex;
SMLoc Loc = Parser.getTok().getLoc(); SMLoc Loc = Parser.getTok().getLoc();
if (getParser().ParseExpression(LaneIndex)) { if (getParser().parseExpression(LaneIndex)) {
Error(Loc, "illegal expression"); Error(Loc, "illegal expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3327,7 +3327,7 @@ parseMemBarrierOptOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
SMLoc Loc = Parser.getTok().getLoc(); SMLoc Loc = Parser.getTok().getLoc();
const MCExpr *MemBarrierID; const MCExpr *MemBarrierID;
if (getParser().ParseExpression(MemBarrierID)) { if (getParser().parseExpression(MemBarrierID)) {
Error(Loc, "illegal expression"); Error(Loc, "illegal expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3543,7 +3543,7 @@ parsePKHImm(SmallVectorImpl<MCParsedAsmOperand*> &Operands, StringRef Op,
const MCExpr *ShiftAmount; const MCExpr *ShiftAmount;
SMLoc Loc = Parser.getTok().getLoc(); SMLoc Loc = Parser.getTok().getLoc();
SMLoc EndLoc; SMLoc EndLoc;
if (getParser().ParseExpression(ShiftAmount, EndLoc)) { if (getParser().parseExpression(ShiftAmount, EndLoc)) {
Error(Loc, "illegal expression"); Error(Loc, "illegal expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3623,7 +3623,7 @@ parseShifterImm(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
const MCExpr *ShiftAmount; const MCExpr *ShiftAmount;
SMLoc EndLoc; SMLoc EndLoc;
if (getParser().ParseExpression(ShiftAmount, EndLoc)) { if (getParser().parseExpression(ShiftAmount, EndLoc)) {
Error(ExLoc, "malformed shift expression"); Error(ExLoc, "malformed shift expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3684,7 +3684,7 @@ parseRotImm(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
const MCExpr *ShiftAmount; const MCExpr *ShiftAmount;
SMLoc EndLoc; SMLoc EndLoc;
if (getParser().ParseExpression(ShiftAmount, EndLoc)) { if (getParser().parseExpression(ShiftAmount, EndLoc)) {
Error(ExLoc, "malformed rotate expression"); Error(ExLoc, "malformed rotate expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3721,7 +3721,7 @@ parseBitfield(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
const MCExpr *LSBExpr; const MCExpr *LSBExpr;
SMLoc E = Parser.getTok().getLoc(); SMLoc E = Parser.getTok().getLoc();
if (getParser().ParseExpression(LSBExpr)) { if (getParser().parseExpression(LSBExpr)) {
Error(E, "malformed immediate expression"); Error(E, "malformed immediate expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3754,7 +3754,7 @@ parseBitfield(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
const MCExpr *WidthExpr; const MCExpr *WidthExpr;
SMLoc EndLoc; SMLoc EndLoc;
if (getParser().ParseExpression(WidthExpr, EndLoc)) { if (getParser().parseExpression(WidthExpr, EndLoc)) {
Error(E, "malformed immediate expression"); Error(E, "malformed immediate expression");
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
} }
@ -3850,7 +3850,7 @@ parseAM3Offset(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
bool isNegative = Parser.getTok().is(AsmToken::Minus); bool isNegative = Parser.getTok().is(AsmToken::Minus);
const MCExpr *Offset; const MCExpr *Offset;
SMLoc E; SMLoc E;
if (getParser().ParseExpression(Offset, E)) if (getParser().parseExpression(Offset, E))
return MatchOperand_ParseFail; return MatchOperand_ParseFail;
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Offset); const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Offset);
if (!CE) { if (!CE) {
@ -4272,7 +4272,7 @@ parseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
E = Parser.getTok().getLoc(); E = Parser.getTok().getLoc();
const MCExpr *Expr; const MCExpr *Expr;
if (getParser().ParseExpression(Expr)) if (getParser().parseExpression(Expr))
return true; return true;
// The expression has to be a constant. Memory references with relocations // The expression has to be a constant. Memory references with relocations
@ -4328,7 +4328,7 @@ parseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
bool isNegative = getParser().getTok().is(AsmToken::Minus); bool isNegative = getParser().getTok().is(AsmToken::Minus);
const MCExpr *Offset; const MCExpr *Offset;
if (getParser().ParseExpression(Offset)) if (getParser().parseExpression(Offset))
return true; return true;
// The expression has to be a constant. Memory references with relocations // The expression has to be a constant. Memory references with relocations
@ -4447,7 +4447,7 @@ bool ARMAsmParser::parseMemRegOffsetShift(ARM_AM::ShiftOpc &St,
Parser.Lex(); // Eat hash token. Parser.Lex(); // Eat hash token.
const MCExpr *Expr; const MCExpr *Expr;
if (getParser().ParseExpression(Expr)) if (getParser().parseExpression(Expr))
return true; return true;
// Range check the immediate. // Range check the immediate.
// lsl, ror: 0 <= imm <= 31 // lsl, ror: 0 <= imm <= 31
@ -4476,7 +4476,7 @@ bool ARMAsmParser::parseMemRegOffsetShift(ARM_AM::ShiftOpc &St,
ARMAsmParser::OperandMatchResultTy ARMAsmParser:: ARMAsmParser::OperandMatchResultTy ARMAsmParser::
parseFPImm(SmallVectorImpl<MCParsedAsmOperand*> &Operands) { parseFPImm(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
// Anything that can accept a floating point constant as an operand // Anything that can accept a floating point constant as an operand
// needs to go through here, as the regular ParseExpression is // needs to go through here, as the regular parseExpression is
// integer only. // integer only.
// //
// This routine still creates a generic Immediate operand, containing // This routine still creates a generic Immediate operand, containing
@ -4596,7 +4596,7 @@ bool ARMAsmParser::parseOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
// identifier (like labels) as expressions and create them as immediates. // identifier (like labels) as expressions and create them as immediates.
const MCExpr *IdVal; const MCExpr *IdVal;
S = Parser.getTok().getLoc(); S = Parser.getTok().getLoc();
if (getParser().ParseExpression(IdVal)) if (getParser().parseExpression(IdVal))
return true; return true;
E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1); E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
Operands.push_back(ARMOperand::CreateImm(IdVal, S, E)); Operands.push_back(ARMOperand::CreateImm(IdVal, S, E));
@ -4615,7 +4615,7 @@ bool ARMAsmParser::parseOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
if (Parser.getTok().isNot(AsmToken::Colon)) { if (Parser.getTok().isNot(AsmToken::Colon)) {
bool isNegative = Parser.getTok().is(AsmToken::Minus); bool isNegative = Parser.getTok().is(AsmToken::Minus);
const MCExpr *ImmVal; const MCExpr *ImmVal;
if (getParser().ParseExpression(ImmVal)) if (getParser().parseExpression(ImmVal))
return true; return true;
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(ImmVal); const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(ImmVal);
if (CE) { if (CE) {
@ -4639,7 +4639,7 @@ bool ARMAsmParser::parseOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
return true; return true;
const MCExpr *SubExprVal; const MCExpr *SubExprVal;
if (getParser().ParseExpression(SubExprVal)) if (getParser().parseExpression(SubExprVal))
return true; return true;
const MCExpr *ExprVal = ARMMCExpr::Create(RefKind, SubExprVal, const MCExpr *ExprVal = ARMMCExpr::Create(RefKind, SubExprVal,
@ -5012,7 +5012,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
// In Thumb1, only the branch (B) instruction can be predicated. // In Thumb1, only the branch (B) instruction can be predicated.
if (isThumbOne() && PredicationCode != ARMCC::AL && Mnemonic != "b") { if (isThumbOne() && PredicationCode != ARMCC::AL && Mnemonic != "b") {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(NameLoc, "conditional execution not supported in Thumb1"); return Error(NameLoc, "conditional execution not supported in Thumb1");
} }
@ -5026,14 +5026,14 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
if (Mnemonic == "it") { if (Mnemonic == "it") {
SMLoc Loc = SMLoc::getFromPointer(NameLoc.getPointer() + 2); SMLoc Loc = SMLoc::getFromPointer(NameLoc.getPointer() + 2);
if (ITMask.size() > 3) { if (ITMask.size() > 3) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "too many conditions on IT instruction"); return Error(Loc, "too many conditions on IT instruction");
} }
unsigned Mask = 8; unsigned Mask = 8;
for (unsigned i = ITMask.size(); i != 0; --i) { for (unsigned i = ITMask.size(); i != 0; --i) {
char pos = ITMask[i - 1]; char pos = ITMask[i - 1];
if (pos != 't' && pos != 'e') { if (pos != 't' && pos != 'e') {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "illegal IT block condition mask '" + ITMask + "'"); return Error(Loc, "illegal IT block condition mask '" + ITMask + "'");
} }
Mask >>= 1; Mask >>= 1;
@ -5059,14 +5059,14 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
// If we had a carry-set on an instruction that can't do that, issue an // If we had a carry-set on an instruction that can't do that, issue an
// error. // error.
if (!CanAcceptCarrySet && CarrySetting) { if (!CanAcceptCarrySet && CarrySetting) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(NameLoc, "instruction '" + Mnemonic + return Error(NameLoc, "instruction '" + Mnemonic +
"' can not set flags, but 's' suffix specified"); "' can not set flags, but 's' suffix specified");
} }
// If we had a predication code on an instruction that can't do that, issue an // If we had a predication code on an instruction that can't do that, issue an
// error. // error.
if (!CanAcceptPredicationCode && PredicationCode != ARMCC::AL) { if (!CanAcceptPredicationCode && PredicationCode != ARMCC::AL) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(NameLoc, "instruction '" + Mnemonic + return Error(NameLoc, "instruction '" + Mnemonic +
"' is not predicable, but condition code specified"); "' is not predicable, but condition code specified");
} }
@ -5115,7 +5115,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
// Read the first operand. // Read the first operand.
if (parseOperand(Operands, Mnemonic)) { if (parseOperand(Operands, Mnemonic)) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return true; return true;
} }
@ -5124,7 +5124,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
// Parse and remember the operand. // Parse and remember the operand.
if (parseOperand(Operands, Mnemonic)) { if (parseOperand(Operands, Mnemonic)) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return true; return true;
} }
} }
@ -5132,7 +5132,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
@ -7614,7 +7614,7 @@ bool ARMAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
for (;;) { for (;;) {
const MCExpr *Value; const MCExpr *Value;
if (getParser().ParseExpression(Value)) if (getParser().parseExpression(Value))
return true; return true;
getParser().getStreamer().EmitValue(Value, Size); getParser().getStreamer().EmitValue(Value, Size);
@ -7761,13 +7761,13 @@ bool ARMAsmParser::parseDirectiveReq(StringRef Name, SMLoc L) {
unsigned Reg; unsigned Reg;
SMLoc SRegLoc, ERegLoc; SMLoc SRegLoc, ERegLoc;
if (ParseRegister(Reg, SRegLoc, ERegLoc)) { if (ParseRegister(Reg, SRegLoc, ERegLoc)) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(SRegLoc, "register name expected"); return Error(SRegLoc, "register name expected");
} }
// Shouldn't be anything else. // Shouldn't be anything else.
if (Parser.getTok().isNot(AsmToken::EndOfStatement)) { if (Parser.getTok().isNot(AsmToken::EndOfStatement)) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Parser.getTok().getLoc(), return Error(Parser.getTok().getLoc(),
"unexpected input in .req directive."); "unexpected input in .req directive.");
} }
@ -7785,7 +7785,7 @@ bool ARMAsmParser::parseDirectiveReq(StringRef Name, SMLoc L) {
/// ::= .unreq registername /// ::= .unreq registername
bool ARMAsmParser::parseDirectiveUnreq(SMLoc L) { bool ARMAsmParser::parseDirectiveUnreq(SMLoc L) {
if (Parser.getTok().isNot(AsmToken::Identifier)) { if (Parser.getTok().isNot(AsmToken::Identifier)) {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(L, "unexpected input in .unreq directive."); return Error(L, "unexpected input in .unreq directive.");
} }
RegisterReqs.erase(Parser.getTok().getIdentifier()); RegisterReqs.erase(Parser.getTok().getIdentifier());

View File

@ -451,7 +451,7 @@ MBlazeOperand *MBlazeAsmParser::ParseImmediate() {
case AsmToken::Minus: case AsmToken::Minus:
case AsmToken::Integer: case AsmToken::Integer:
case AsmToken::Identifier: case AsmToken::Identifier:
if (getParser().ParseExpression(EVal)) if (getParser().parseExpression(EVal))
return 0; return 0;
return MBlazeOperand::CreateImm(EVal, S, E); return MBlazeOperand::CreateImm(EVal, S, E);
@ -537,7 +537,7 @@ bool MBlazeAsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
for (;;) { for (;;) {
const MCExpr *Value; const MCExpr *Value;
if (getParser().ParseExpression(Value)) if (getParser().parseExpression(Value))
return true; return true;
getParser().getStreamer().EmitValue(Value, Size); getParser().getStreamer().EmitValue(Value, Size);

View File

@ -811,7 +811,7 @@ bool MipsAsmParser::ParseOperand(SmallVectorImpl<MCParsedAsmOperand*>&Operands,
} }
// maybe it is a symbol reference // maybe it is a symbol reference
StringRef Identifier; StringRef Identifier;
if (Parser.ParseIdentifier(Identifier)) if (Parser.parseIdentifier(Identifier))
return true; return true;
SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1); SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
@ -834,7 +834,7 @@ bool MipsAsmParser::ParseOperand(SmallVectorImpl<MCParsedAsmOperand*>&Operands,
// quoted label names // quoted label names
const MCExpr *IdVal; const MCExpr *IdVal;
SMLoc S = Parser.getTok().getLoc(); SMLoc S = Parser.getTok().getLoc();
if (getParser().ParseExpression(IdVal)) if (getParser().parseExpression(IdVal))
return true; return true;
SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1); SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
Operands.push_back(MipsOperand::CreateImm(IdVal, S, E)); Operands.push_back(MipsOperand::CreateImm(IdVal, S, E));
@ -886,7 +886,7 @@ bool MipsAsmParser::parseRelocOperand(const MCExpr *&Res) {
} else } else
break; break;
} }
if (getParser().ParseParenExpression(IdVal,EndLoc)) if (getParser().parseParenExpression(IdVal,EndLoc))
return true; return true;
while (getLexer().getKind() == AsmToken::RParen) while (getLexer().getKind() == AsmToken::RParen)
@ -937,7 +937,7 @@ bool MipsAsmParser::parseMemOffset(const MCExpr *&Res) {
case AsmToken::Integer: case AsmToken::Integer:
case AsmToken::Minus: case AsmToken::Minus:
case AsmToken::Plus: case AsmToken::Plus:
return (getParser().ParseExpression(Res)); return (getParser().parseExpression(Res));
case AsmToken::Percent: case AsmToken::Percent:
return parseRelocOperand(Res); return parseRelocOperand(Res);
case AsmToken::LParen: case AsmToken::LParen:
@ -1203,13 +1203,13 @@ parseMathOperation(StringRef Name, SMLoc NameLoc,
// Read the first operand. // Read the first operand.
if (ParseOperand(Operands, Name)) { if (ParseOperand(Operands, Name)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
if (getLexer().isNot(AsmToken::Comma)) { if (getLexer().isNot(AsmToken::Comma)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
@ -1221,14 +1221,14 @@ parseMathOperation(StringRef Name, SMLoc NameLoc,
// Parse and remember the operand. // Parse and remember the operand.
if (ParseOperand(Operands, Name)) { if (ParseOperand(Operands, Name)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
} }
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
@ -1290,7 +1290,7 @@ ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
// Read the first operand. // Read the first operand.
if (ParseOperand(Operands, Name)) { if (ParseOperand(Operands, Name)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
@ -1300,7 +1300,7 @@ ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
// Parse and remember the operand. // Parse and remember the operand.
if (ParseOperand(Operands, Name)) { if (ParseOperand(Operands, Name)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
} }
@ -1308,7 +1308,7 @@ ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
@ -1318,7 +1318,7 @@ ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
bool MipsAsmParser::reportParseError(StringRef ErrorMsg) { bool MipsAsmParser::reportParseError(StringRef ErrorMsg) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, ErrorMsg); return Error(Loc, ErrorMsg);
} }
@ -1446,11 +1446,11 @@ bool MipsAsmParser::parseDirectiveSet() {
return parseSetNoMacroDirective(); return parseSetNoMacroDirective();
} else if (Tok.getString() == "nomips16") { } else if (Tok.getString() == "nomips16") {
// ignore this directive for now // ignore this directive for now
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return false; return false;
} else if (Tok.getString() == "nomicromips") { } else if (Tok.getString() == "nomicromips") {
// ignore this directive for now // ignore this directive for now
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return false; return false;
} }
@ -1463,7 +1463,7 @@ bool MipsAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
for (;;) { for (;;) {
const MCExpr *Value; const MCExpr *Value;
if (getParser().ParseExpression(Value)) if (getParser().parseExpression(Value))
return true; return true;
getParser().getStreamer().EmitValue(Value, Size); getParser().getStreamer().EmitValue(Value, Size);
@ -1500,7 +1500,7 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
if (IDVal == ".frame") { if (IDVal == ".frame") {
// ignore this directive for now // ignore this directive for now
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return false; return false;
} }
@ -1510,19 +1510,19 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
if (IDVal == ".fmask") { if (IDVal == ".fmask") {
// ignore this directive for now // ignore this directive for now
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return false; return false;
} }
if (IDVal == ".mask") { if (IDVal == ".mask") {
// ignore this directive for now // ignore this directive for now
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return false; return false;
} }
if (IDVal == ".gpword") { if (IDVal == ".gpword") {
// ignore this directive for now // ignore this directive for now
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return false; return false;
} }

View File

@ -906,7 +906,7 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned SegReg,
if (getLexer().is(AsmToken::Identifier)) { if (getLexer().is(AsmToken::Identifier)) {
if (ParseRegister(TmpReg, Start, End)) { if (ParseRegister(TmpReg, Start, End)) {
const MCExpr *Disp; const MCExpr *Disp;
if (getParser().ParseExpression(Disp, End)) if (getParser().parseExpression(Disp, End))
return 0; return 0;
if (getLexer().isNot(AsmToken::RBrac)) if (getLexer().isNot(AsmToken::RBrac))
@ -951,7 +951,7 @@ X86Operand *X86AsmParser::ParseIntelBracExpression(unsigned SegReg,
SM.onRegister(TmpReg); SM.onRegister(TmpReg);
UpdateLocLex = false; UpdateLocLex = false;
break; break;
} else if (!getParser().ParseExpression(Disp, End)) { } else if (!getParser().parseExpression(Disp, End)) {
SM.onDispExpr(); SM.onDispExpr();
UpdateLocLex = false; UpdateLocLex = false;
break; break;
@ -1033,7 +1033,7 @@ X86Operand *X86AsmParser::ParseIntelMemOperand(unsigned SegReg, SMLoc Start) {
} }
const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext()); const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
if (getParser().ParseExpression(Disp, End)) if (getParser().parseExpression(Disp, End))
return 0; return 0;
bool NeedSizeDir = false; bool NeedSizeDir = false;
@ -1135,7 +1135,7 @@ X86Operand *X86AsmParser::ParseIntelOffsetOfOperator(SMLoc Start) {
SMLoc End; SMLoc End;
const MCExpr *Val; const MCExpr *Val;
if (getParser().ParseExpression(Val, End)) if (getParser().parseExpression(Val, End))
return ErrorOperand(Start, "Unable to parse expression!"); return ErrorOperand(Start, "Unable to parse expression!");
// Don't emit the offset operator. // Don't emit the offset operator.
@ -1169,7 +1169,7 @@ X86Operand *X86AsmParser::ParseIntelOperator(SMLoc Start, unsigned OpKind) {
SMLoc End; SMLoc End;
const MCExpr *Val; const MCExpr *Val;
if (getParser().ParseExpression(Val, End)) if (getParser().parseExpression(Val, End))
return 0; return 0;
unsigned Length = 0, Size = 0, Type = 0; unsigned Length = 0, Size = 0, Type = 0;
@ -1220,7 +1220,7 @@ X86Operand *X86AsmParser::ParseIntelOperand() {
if (getLexer().is(AsmToken::Integer) || getLexer().is(AsmToken::Real) || if (getLexer().is(AsmToken::Integer) || getLexer().is(AsmToken::Real) ||
getLexer().is(AsmToken::Minus)) { getLexer().is(AsmToken::Minus)) {
const MCExpr *Val; const MCExpr *Val;
if (!getParser().ParseExpression(Val, End)) { if (!getParser().parseExpression(Val, End)) {
return X86Operand::CreateImm(Val, Start, End); return X86Operand::CreateImm(Val, Start, End);
} }
} }
@ -1271,7 +1271,7 @@ X86Operand *X86AsmParser::ParseATTOperand() {
SMLoc Start = Parser.getTok().getLoc(), End; SMLoc Start = Parser.getTok().getLoc(), End;
Parser.Lex(); Parser.Lex();
const MCExpr *Val; const MCExpr *Val;
if (getParser().ParseExpression(Val, End)) if (getParser().parseExpression(Val, End))
return 0; return 0;
return X86Operand::CreateImm(Val, Start, End); return X86Operand::CreateImm(Val, Start, End);
} }
@ -1289,7 +1289,7 @@ X86Operand *X86AsmParser::ParseMemOperand(unsigned SegReg, SMLoc MemStart) {
const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext()); const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
if (getLexer().isNot(AsmToken::LParen)) { if (getLexer().isNot(AsmToken::LParen)) {
SMLoc ExprEnd; SMLoc ExprEnd;
if (getParser().ParseExpression(Disp, ExprEnd)) return 0; if (getParser().parseExpression(Disp, ExprEnd)) return 0;
// After parsing the base expression we could either have a parenthesized // After parsing the base expression we could either have a parenthesized
// memory address or not. If not, return now. If so, eat the (. // memory address or not. If not, return now. If so, eat the (.
@ -1315,7 +1315,7 @@ X86Operand *X86AsmParser::ParseMemOperand(unsigned SegReg, SMLoc MemStart) {
SMLoc ExprEnd; SMLoc ExprEnd;
// It must be an parenthesized expression, parse it now. // It must be an parenthesized expression, parse it now.
if (getParser().ParseParenExpression(Disp, ExprEnd)) if (getParser().parseParenExpression(Disp, ExprEnd))
return 0; return 0;
// After parsing the base expression we could either have a parenthesized // After parsing the base expression we could either have a parenthesized
@ -1375,7 +1375,7 @@ X86Operand *X86AsmParser::ParseMemOperand(unsigned SegReg, SMLoc MemStart) {
SMLoc Loc = Parser.getTok().getLoc(); SMLoc Loc = Parser.getTok().getLoc();
int64_t ScaleVal; int64_t ScaleVal;
if (getParser().ParseAbsoluteExpression(ScaleVal)){ if (getParser().parseAbsoluteExpression(ScaleVal)){
Error(Loc, "expected scale expression"); Error(Loc, "expected scale expression");
return 0; return 0;
} }
@ -1394,7 +1394,7 @@ X86Operand *X86AsmParser::ParseMemOperand(unsigned SegReg, SMLoc MemStart) {
SMLoc Loc = Parser.getTok().getLoc(); SMLoc Loc = Parser.getTok().getLoc();
int64_t Value; int64_t Value;
if (getParser().ParseAbsoluteExpression(Value)) if (getParser().parseAbsoluteExpression(Value))
return 0; return 0;
if (Value != 1) if (Value != 1)
@ -1535,7 +1535,7 @@ ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
if (X86Operand *Op = ParseOperand()) if (X86Operand *Op = ParseOperand())
Operands.push_back(Op); Operands.push_back(Op);
else { else {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return true; return true;
} }
@ -1546,14 +1546,14 @@ ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc,
if (X86Operand *Op = ParseOperand()) if (X86Operand *Op = ParseOperand())
Operands.push_back(Op); Operands.push_back(Op);
else { else {
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return true; return true;
} }
} }
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
SMLoc Loc = getLexer().getLoc(); SMLoc Loc = getLexer().getLoc();
Parser.EatToEndOfStatement(); Parser.eatToEndOfStatement();
return Error(Loc, "unexpected token in argument list"); return Error(Loc, "unexpected token in argument list");
} }
} }
@ -2243,7 +2243,7 @@ bool X86AsmParser::ParseDirectiveWord(unsigned Size, SMLoc L) {
if (getLexer().isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
for (;;) { for (;;) {
const MCExpr *Value; const MCExpr *Value;
if (getParser().ParseExpression(Value)) if (getParser().parseExpression(Value))
return true; return true;
getParser().getStreamer().EmitValue(Value, Size); getParser().getStreamer().EmitValue(Value, Size);