diff options
author | Jim Grosbach <grosbach@apple.com> | 2013-02-20 22:21:35 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2013-02-20 22:21:35 +0000 |
commit | cb2ae3d98e3bb36e5813f8f69b00d39efd026dcd (patch) | |
tree | e617c84a39ac3bb9e533563ba708b8123d56ded0 /lib/MC | |
parent | 6189288766d9cf2e1cf82c1b41655e33754da83b (diff) |
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
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 220 | ||||
-rw-r--r-- | lib/MC/MCParser/COFFAsmParser.cpp | 76 | ||||
-rw-r--r-- | lib/MC/MCParser/DarwinAsmParser.cpp | 158 | ||||
-rw-r--r-- | lib/MC/MCParser/ELFAsmParser.cpp | 82 | ||||
-rw-r--r-- | lib/MC/MCParser/MCAsmParser.cpp | 4 |
5 files changed, 270 insertions, 270 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 9c998ff796..6ab49ec92c 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -140,7 +140,7 @@ private: /// ExtensionDirectiveMap - maps directive names to handler methods in parser /// extensions. Extensions register themselves in this map by calling - /// AddDirectiveHandler. + /// addDirectiveHandler. StringMap<ExtensionDirectiveHandler> ExtensionDirectiveMap; /// MacroMap - Map of currently defined macros. @@ -177,7 +177,7 @@ public: virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false); - virtual void AddDirectiveHandler(StringRef Directive, + virtual void addDirectiveHandler(StringRef Directive, ExtensionDirectiveHandler Handler) { ExtensionDirectiveMap[Directive] = Handler; } @@ -210,7 +210,7 @@ public: void setParsingInlineAsm(bool V) { ParsingInlineAsm = V; } bool isParsingInlineAsm() { return ParsingInlineAsm; } - bool ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, + bool parseMSInlineAsm(void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl<std::pair<void *,bool> > &OpDecls, SmallVectorImpl<std::string> &Constraints, @@ -219,17 +219,17 @@ public: const MCInstPrinter *IP, MCAsmParserSemaCallback &SI); - bool ParseExpression(const MCExpr *&Res); - virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc); - virtual bool ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc); - virtual bool ParseAbsoluteExpression(int64_t &Res); + bool parseExpression(const MCExpr *&Res); + virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc); + virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc); + 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. - virtual bool ParseIdentifier(StringRef &Res); - virtual void EatToEndOfStatement(); + virtual bool parseIdentifier(StringRef &Res); + virtual void eatToEndOfStatement(); - virtual void CheckForValidSection(); + virtual void checkForValidSection(); /// } private: @@ -307,7 +307,7 @@ private: /// \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 /// 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, /// return the contents from the current token up to the end or comma. @@ -430,7 +430,7 @@ private: bool ParseDirectiveElseIf(SMLoc DirectiveLoc); // ".elseif" bool ParseDirectiveElse(SMLoc DirectiveLoc); // ".else" bool ParseDirectiveEndIf(SMLoc DirectiveLoc); // .endif - virtual bool ParseEscapedString(std::string &Data); + virtual bool parseEscapedString(std::string &Data); const MCExpr *ApplyModifierToExpr(const MCExpr *E, 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 // the next line. assert(HadError && "Parse statement returned an error, but none emitted!"); - EatToEndOfStatement(); + eatToEndOfStatement(); } if (TheCondState.TheCond != StartingCondState.TheCond || @@ -665,15 +665,15 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { return HadError; } -void AsmParser::CheckForValidSection() { +void AsmParser::checkForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.InitToTextSection(); } } -/// EatToEndOfStatement - Throw away the rest of the line for testing purposes. -void AsmParser::EatToEndOfStatement() { +/// eatToEndOfStatement - Throw away the rest of the line for testing purposes. +void AsmParser::eatToEndOfStatement() { while (Lexer.isNot(AsmToken::EndOfStatement) && Lexer.isNot(AsmToken::Eof)) Lex(); @@ -683,7 +683,7 @@ void AsmParser::EatToEndOfStatement() { Lex(); } -StringRef AsmParser::ParseStringToEndOfStatement() { +StringRef AsmParser::parseStringToEndOfStatement() { const char *Start = getTok().getLoc().getPointer(); while (Lexer.isNot(AsmToken::EndOfStatement) && @@ -712,7 +712,7 @@ StringRef AsmParser::ParseStringToComma() { /// parenexpr ::= expr) /// bool AsmParser::ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc) { - if (ParseExpression(Res)) return true; + if (parseExpression(Res)) return true; if (Lexer.isNot(AsmToken::RParen)) return TokError("expected ')' in parentheses expression"); EndLoc = Lexer.getTok().getEndLoc(); @@ -726,7 +726,7 @@ bool AsmParser::ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc) { /// bracketexpr ::= expr] /// bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) { - if (ParseExpression(Res)) return true; + if (parseExpression(Res)) return true; if (Lexer.isNot(AsmToken::RBrac)) return TokError("expected ']' in brackets expression"); EndLoc = Lexer.getTok().getEndLoc(); @@ -759,7 +759,7 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) { case AsmToken::String: case AsmToken::Identifier: { StringRef Identifier; - if (ParseIdentifier(Identifier)) { + if (parseIdentifier(Identifier)) { if (FirstTokenKind == AsmToken::Dollar) return Error(FirstTokenLoc, "invalid token in expression"); 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; - return ParseExpression(Res, EndLoc); + return parseExpression(Res, EndLoc); } const MCExpr * @@ -917,7 +917,7 @@ AsmParser::ApplyModifierToExpr(const MCExpr *E, 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 @@ -927,7 +927,7 @@ AsmParser::ApplyModifierToExpr(const MCExpr *E, /// expr ::= expr *,/,% expr -> highest. /// expr ::= primaryexpr /// -bool AsmParser::ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) { +bool AsmParser::parseExpression(const MCExpr *&Res, SMLoc &EndLoc) { // Parse the expression. Res = 0; if (ParsePrimaryExpr(Res, EndLoc) || ParseBinOpRHS(1, Res, EndLoc)) @@ -965,17 +965,17 @@ bool AsmParser::ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) { return false; } -bool AsmParser::ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) { +bool AsmParser::parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) { Res = 0; return ParseParenExpr(Res, EndLoc) || ParseBinOpRHS(1, Res, EndLoc); } -bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { +bool AsmParser::parseAbsoluteExpression(int64_t &Res) { const MCExpr *Expr; SMLoc StartLoc = Lexer.getLoc(); - if (ParseExpression(Expr)) + if (parseExpression(Expr)) return true; if (!Expr->EvaluateAsAbsolute(Res)) @@ -1134,7 +1134,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) { // Treat '.' as a valid identifier in this context. Lex(); IDVal = "."; - } else if (ParseIdentifier(IDVal)) { + } else if (parseIdentifier(IDVal)) { if (!TheCondState.Ignore) return TokError("unexpected token at start of statement"); IDVal = ""; @@ -1177,7 +1177,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) { // Ignore the statement if in the middle of inactive conditional // (e.g. ".if 0"). if (TheCondState.Ignore) { - EatToEndOfStatement(); + eatToEndOfStatement(); return false; } @@ -1186,7 +1186,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) { // See what kind of statement we have. switch (Lexer.getKind()) { case AsmToken::Colon: { - CheckForValidSection(); + checkForValidSection(); // identifier ':' -> Label. Lex(); @@ -1332,7 +1332,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) { case DK_ZERO: return ParseDirectiveZero(); case DK_EXTERN: - EatToEndOfStatement(); // .extern is the default, ignore it. + eatToEndOfStatement(); // .extern is the default, ignore it. return false; case DK_GLOBL: case DK_GLOBAL: @@ -1460,7 +1460,7 @@ bool AsmParser::ParseStatement(ParseStatementInfo &Info) { if (ParsingInlineAsm && (IDVal == "align" || IDVal == "ALIGN")) return ParseDirectiveMSAlign(IDLoc, Info); - CheckForValidSection(); + checkForValidSection(); // Canonicalize the opcode to lower case. std::string OpcodeStr = IDVal.lower(); @@ -2002,7 +2002,7 @@ bool AsmParser::ParseAssignment(StringRef Name, bool allow_redef, SMLoc EqualLoc = Lexer.getLoc(); const MCExpr *Value; - if (ParseExpression(Value)) + if (parseExpression(Value)) return true; // 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; } -/// ParseIdentifier: +/// parseIdentifier: /// ::= identifier /// ::= string -bool AsmParser::ParseIdentifier(StringRef &Res) { +bool AsmParser::parseIdentifier(StringRef &Res) { // The assembler has relaxed rules for accepting identifiers, in particular we // allow things like '.globl $foo', which would normally be separate // 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) { StringRef Name; - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("expected identifier after '" + Twine(IDVal) + "'"); if (getLexer().isNot(AsmToken::Comma)) @@ -2115,7 +2115,7 @@ bool AsmParser::ParseDirectiveSet(StringRef IDVal, bool allow_redef) { 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!"); Data = ""; @@ -2177,14 +2177,14 @@ bool AsmParser::ParseEscapedString(std::string &Data) { /// ::= ( .ascii | .asciz | .string ) [ "string" ( , "string" )* ] bool AsmParser::ParseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) { if (getLexer().isNot(AsmToken::EndOfStatement)) { - CheckForValidSection(); + checkForValidSection(); for (;;) { if (getLexer().isNot(AsmToken::String)) return TokError("expected string in '" + Twine(IDVal) + "' directive"); std::string Data; - if (ParseEscapedString(Data)) + if (parseEscapedString(Data)) return true; getStreamer().EmitBytes(Data, DEFAULT_ADDRSPACE); @@ -2210,12 +2210,12 @@ bool AsmParser::ParseDirectiveAscii(StringRef IDVal, bool ZeroTerminated) { /// ::= (.byte | .short | ... ) [ expression (, expression)* ] bool AsmParser::ParseDirectiveValue(unsigned Size) { if (getLexer().isNot(AsmToken::EndOfStatement)) { - CheckForValidSection(); + checkForValidSection(); for (;;) { const MCExpr *Value; SMLoc ExprLoc = getLexer().getLoc(); - if (ParseExpression(Value)) + if (parseExpression(Value)) return true; // Special case constant expressions to match code generator. @@ -2246,7 +2246,7 @@ bool AsmParser::ParseDirectiveValue(unsigned Size) { /// ::= (.single | .double) [ expression (, expression)* ] bool AsmParser::ParseDirectiveRealValue(const fltSemantics &Semantics) { if (getLexer().isNot(AsmToken::EndOfStatement)) { - CheckForValidSection(); + checkForValidSection(); for (;;) { // We don't truly support arithmetic on floating point expressions, so we @@ -2303,16 +2303,16 @@ bool AsmParser::ParseDirectiveRealValue(const fltSemantics &Semantics) { /// ParseDirectiveZero /// ::= .zero expression bool AsmParser::ParseDirectiveZero() { - CheckForValidSection(); + checkForValidSection(); int64_t NumBytes; - if (ParseAbsoluteExpression(NumBytes)) + if (parseAbsoluteExpression(NumBytes)) return true; int64_t Val = 0; if (getLexer().is(AsmToken::Comma)) { Lex(); - if (ParseAbsoluteExpression(Val)) + if (parseAbsoluteExpression(Val)) return true; } @@ -2329,10 +2329,10 @@ bool AsmParser::ParseDirectiveZero() { /// ParseDirectiveFill /// ::= .fill expression , expression , expression bool AsmParser::ParseDirectiveFill() { - CheckForValidSection(); + checkForValidSection(); int64_t NumValues; - if (ParseAbsoluteExpression(NumValues)) + if (parseAbsoluteExpression(NumValues)) return true; if (getLexer().isNot(AsmToken::Comma)) @@ -2340,7 +2340,7 @@ bool AsmParser::ParseDirectiveFill() { Lex(); int64_t FillSize; - if (ParseAbsoluteExpression(FillSize)) + if (parseAbsoluteExpression(FillSize)) return true; if (getLexer().isNot(AsmToken::Comma)) @@ -2348,7 +2348,7 @@ bool AsmParser::ParseDirectiveFill() { Lex(); int64_t FillExpr; - if (ParseAbsoluteExpression(FillExpr)) + if (parseAbsoluteExpression(FillExpr)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -2368,11 +2368,11 @@ bool AsmParser::ParseDirectiveFill() { /// ParseDirectiveOrg /// ::= .org expression [ , expression ] bool AsmParser::ParseDirectiveOrg() { - CheckForValidSection(); + checkForValidSection(); const MCExpr *Offset; SMLoc Loc = getTok().getLoc(); - if (ParseExpression(Offset)) + if (parseExpression(Offset)) return true; // Parse optional fill expression. @@ -2382,7 +2382,7 @@ bool AsmParser::ParseDirectiveOrg() { return TokError("unexpected token in '.org' directive"); Lex(); - if (ParseAbsoluteExpression(FillExpr)) + if (parseAbsoluteExpression(FillExpr)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -2403,11 +2403,11 @@ bool AsmParser::ParseDirectiveOrg() { /// ParseDirectiveAlign /// ::= {.align, ...} expression [ , expression [ , expression ]] bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { - CheckForValidSection(); + checkForValidSection(); SMLoc AlignmentLoc = getLexer().getLoc(); int64_t Alignment; - if (ParseAbsoluteExpression(Alignment)) + if (parseAbsoluteExpression(Alignment)) return true; SMLoc MaxBytesLoc; @@ -2424,7 +2424,7 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { // .align 3,,4 if (getLexer().isNot(AsmToken::Comma)) { HasFillExpr = true; - if (ParseAbsoluteExpression(FillExpr)) + if (parseAbsoluteExpression(FillExpr)) return true; } @@ -2434,7 +2434,7 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { Lex(); MaxBytesLoc = getLexer().getLoc(); - if (ParseAbsoluteExpression(MaxBytesToFill)) + if (parseAbsoluteExpression(MaxBytesToFill)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -2608,7 +2608,7 @@ bool AsmParser::ParseDirectiveLoc() { StringRef Name; SMLoc Loc = getTok().getLoc(); - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("unexpected token in '.loc' directive"); if (Name == "basic_block") @@ -2620,7 +2620,7 @@ bool AsmParser::ParseDirectiveLoc() { else if (Name == "is_stmt") { Loc = getTok().getLoc(); const MCExpr *Value; - if (ParseExpression(Value)) + if (parseExpression(Value)) return true; // The expression must be the constant 0 or 1. if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value)) { @@ -2639,7 +2639,7 @@ bool AsmParser::ParseDirectiveLoc() { else if (Name == "isa") { Loc = getTok().getLoc(); const MCExpr *Value; - if (ParseExpression(Value)) + if (parseExpression(Value)) return true; // The expression must be a constant greater or equal to 0. if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value)) { @@ -2653,7 +2653,7 @@ bool AsmParser::ParseDirectiveLoc() { } } else if (Name == "discriminator") { - if (ParseAbsoluteExpression(Discriminator)) + if (parseAbsoluteExpression(Discriminator)) return true; } else { @@ -2684,7 +2684,7 @@ bool AsmParser::ParseDirectiveCFISections() { bool EH = false; bool Debug = false; - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("Expected an identifier"); if (Name == ".eh_frame") @@ -2695,7 +2695,7 @@ bool AsmParser::ParseDirectiveCFISections() { if (getLexer().is(AsmToken::Comma)) { Lex(); - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("Expected an identifier"); if (Name == ".eh_frame") @@ -2732,7 +2732,7 @@ bool AsmParser::ParseRegisterOrRegisterNumber(int64_t &Register, return true; Register = getContext().getRegisterInfo().getDwarfRegNum(RegNo, true); } else - return ParseAbsoluteExpression(Register); + return parseAbsoluteExpression(Register); return false; } @@ -2749,7 +2749,7 @@ bool AsmParser::ParseDirectiveCFIDefCfa(SMLoc DirectiveLoc) { Lex(); int64_t Offset = 0; - if (ParseAbsoluteExpression(Offset)) + if (parseAbsoluteExpression(Offset)) return true; getStreamer().EmitCFIDefCfa(Register, Offset); @@ -2760,7 +2760,7 @@ bool AsmParser::ParseDirectiveCFIDefCfa(SMLoc DirectiveLoc) { /// ::= .cfi_def_cfa_offset offset bool AsmParser::ParseDirectiveCFIDefCfaOffset() { int64_t Offset = 0; - if (ParseAbsoluteExpression(Offset)) + if (parseAbsoluteExpression(Offset)) return true; getStreamer().EmitCFIDefCfaOffset(Offset); @@ -2790,7 +2790,7 @@ bool AsmParser::ParseDirectiveCFIRegister(SMLoc DirectiveLoc) { /// ::= .cfi_adjust_cfa_offset adjustment bool AsmParser::ParseDirectiveCFIAdjustCfaOffset() { int64_t Adjustment = 0; - if (ParseAbsoluteExpression(Adjustment)) + if (parseAbsoluteExpression(Adjustment)) return true; getStreamer().EmitCFIAdjustCfaOffset(Adjustment); @@ -2821,7 +2821,7 @@ bool AsmParser::ParseDirectiveCFIOffset(SMLoc DirectiveLoc) { return TokError("unexpected token in directive"); Lex(); - if (ParseAbsoluteExpression(Offset)) + if (parseAbsoluteExpression(Offset)) return true; getStreamer().EmitCFIOffset(Register, Offset); @@ -2841,7 +2841,7 @@ bool AsmParser::ParseDirectiveCFIRelOffset(SMLoc DirectiveLoc) { Lex(); int64_t Offset = 0; - if (ParseAbsoluteExpression(Offset)) + if (parseAbsoluteExpression(Offset)) return true; getStreamer().EmitCFIRelOffset(Register, Offset); @@ -2876,7 +2876,7 @@ static bool isValidEncoding(int64_t Encoding) { /// ::= .cfi_lsda encoding, [symbol_name] bool AsmParser::ParseDirectiveCFIPersonalityOrLsda(bool IsPersonality) { int64_t Encoding = 0; - if (ParseAbsoluteExpression(Encoding)) + if (parseAbsoluteExpression(Encoding)) return true; if (Encoding == dwarf::DW_EH_PE_omit) return false; @@ -2889,7 +2889,7 @@ bool AsmParser::ParseDirectiveCFIPersonalityOrLsda(bool IsPersonality) { Lex(); StringRef Name; - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("expected identifier in directive"); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); @@ -2943,7 +2943,7 @@ bool AsmParser::ParseDirectiveCFIRestore(SMLoc DirectiveLoc) { bool AsmParser::ParseDirectiveCFIEscape() { std::string Values; int64_t CurrValue; - if (ParseAbsoluteExpression(CurrValue)) + if (parseAbsoluteExpression(CurrValue)) return true; Values.push_back((uint8_t)CurrValue); @@ -2951,7 +2951,7 @@ bool AsmParser::ParseDirectiveCFIEscape() { while (getLexer().is(AsmToken::Comma)) { Lex(); - if (ParseAbsoluteExpression(CurrValue)) + if (parseAbsoluteExpression(CurrValue)) return true; Values.push_back((uint8_t)CurrValue); @@ -3000,7 +3000,7 @@ bool AsmParser::ParseDirectiveMacrosOnOff(StringRef Directive) { /// ::= .macro name [parameters] bool AsmParser::ParseDirectiveMacro(SMLoc DirectiveLoc) { StringRef Name; - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("expected identifier in '.macro' directive"); MCAsmMacroParameters Parameters; @@ -3010,7 +3010,7 @@ bool AsmParser::ParseDirectiveMacro(SMLoc DirectiveLoc) { if (getLexer().isNot(AsmToken::EndOfStatement)) { for (;;) { MCAsmMacroParameter Parameter; - if (ParseIdentifier(Parameter.first)) + if (parseIdentifier(Parameter.first)) return TokError("expected identifier in '.macro' directive"); if (getLexer().is(AsmToken::Equal)) { @@ -3052,7 +3052,7 @@ bool AsmParser::ParseDirectiveMacro(SMLoc DirectiveLoc) { } // Otherwise, scan til the end of the statement. - EatToEndOfStatement(); + eatToEndOfStatement(); } if (LookupMacro(Name)) { @@ -3193,7 +3193,7 @@ bool AsmParser::ParseDirectiveEndMacro(StringRef Directive) { /// ::= .purgem bool AsmParser::ParseDirectivePurgeMacro(SMLoc DirectiveLoc) { StringRef Name; - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("expected identifier in '.purgem' directive"); if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -3209,13 +3209,13 @@ bool AsmParser::ParseDirectivePurgeMacro(SMLoc DirectiveLoc) { /// ParseDirectiveBundleAlignMode /// ::= {.bundle_align_mode} expression bool AsmParser::ParseDirectiveBundleAlignMode() { - CheckForValidSection(); + checkForValidSection(); // Expect a single argument: an expression that evaluates to a constant // in the inclusive range 0-30. SMLoc ExprLoc = getLexer().getLoc(); int64_t AlignSizePow2; - if (ParseAbsoluteExpression(AlignSizePow2)) + if (parseAbsoluteExpression(AlignSizePow2)) return true; else if (getLexer().isNot(AsmToken::EndOfStatement)) return TokError("unexpected token after expression in" @@ -3235,7 +3235,7 @@ bool AsmParser::ParseDirectiveBundleAlignMode() { /// ParseDirectiveBundleLock /// ::= {.bundle_lock} [align_to_end] bool AsmParser::ParseDirectiveBundleLock() { - CheckForValidSection(); + checkForValidSection(); bool AlignToEnd = false; if (getLexer().isNot(AsmToken::EndOfStatement)) { @@ -3244,7 +3244,7 @@ bool AsmParser::ParseDirectiveBundleLock() { const char *kInvalidOptionError = "invalid option for '.bundle_lock' directive"; - if (ParseIdentifier(Option)) + if (parseIdentifier(Option)) return Error(Loc, kInvalidOptionError); if (Option != "align_to_end") @@ -3264,7 +3264,7 @@ bool AsmParser::ParseDirectiveBundleLock() { /// ParseDirectiveBundleLock /// ::= {.bundle_lock} bool AsmParser::ParseDirectiveBundleUnlock() { - CheckForValidSection(); + checkForValidSection(); if (getLexer().isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.bundle_unlock' directive"); @@ -3277,10 +3277,10 @@ bool AsmParser::ParseDirectiveBundleUnlock() { /// ParseDirectiveSpace /// ::= (.skip | .space) expression [ , expression ] bool AsmParser::ParseDirectiveSpace(StringRef IDVal) { - CheckForValidSection(); + checkForValidSection(); int64_t NumBytes; - if (ParseAbsoluteExpression(NumBytes)) + if (parseAbsoluteExpression(NumBytes)) return true; int64_t FillExpr = 0; @@ -3289,7 +3289,7 @@ bool AsmParser::ParseDirectiveSpace(StringRef IDVal) { return TokError("unexpected token in '" + Twine(IDVal) + "' directive"); Lex(); - if (ParseAbsoluteExpression(FillExpr)) + if (parseAbsoluteExpression(FillExpr)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -3311,10 +3311,10 @@ bool AsmParser::ParseDirectiveSpace(StringRef IDVal) { /// ParseDirectiveLEB128 /// ::= (.sleb128 | .uleb128) expression bool AsmParser::ParseDirectiveLEB128(bool Signed) { - CheckForValidSection(); + checkForValidSection(); const MCExpr *Value; - if (ParseExpression(Value)) + if (parseExpression(Value)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -3336,7 +3336,7 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCSymbolAttr Attr) { StringRef Name; SMLoc Loc = getTok().getLoc(); - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return Error(Loc, "expected identifier in directive"); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); @@ -3363,11 +3363,11 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCSymbolAttr Attr) { /// ParseDirectiveComm /// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ] bool AsmParser::ParseDirectiveComm(bool IsLocal) { - CheckForValidSection(); + checkForValidSection(); SMLoc IDLoc = getLexer().getLoc(); StringRef Name; - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("expected identifier in directive"); // Handle the identifier as the key symbol. @@ -3379,7 +3379,7 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) { int64_t Size; SMLoc SizeLoc = getLexer().getLoc(); - if (ParseAbsoluteExpression(Size)) + if (parseAbsoluteExpression(Size)) return true; int64_t Pow2Alignment = 0; @@ -3387,7 +3387,7 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) { if (getLexer().is(AsmToken::Comma)) { Lex(); Pow2AlignmentLoc = getLexer().getLoc(); - if (ParseAbsoluteExpression(Pow2Alignment)) + if (parseAbsoluteExpression(Pow2Alignment)) return true; LCOMM::LCOMMType LCOMM = Lexer.getMAI().getLCOMMDirectiveAlignmentType(); @@ -3440,7 +3440,7 @@ bool AsmParser::ParseDirectiveAbort() { // FIXME: Use loc from directive. SMLoc Loc = getLexer().getLoc(); - StringRef Str = ParseStringToEndOfStatement(); + StringRef Str = parseStringToEndOfStatement(); if (getLexer().isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.abort' directive"); @@ -3512,10 +3512,10 @@ bool AsmParser::ParseDirectiveIf(SMLoc DirectiveLoc) { TheCondStack.push_back(TheCondState); TheCondState.TheCond = AsmCond::IfCond; if (TheCondState.Ignore) { - EatToEndOfStatement(); + eatToEndOfStatement(); } else { int64_t ExprValue; - if (ParseAbsoluteExpression(ExprValue)) + if (parseAbsoluteExpression(ExprValue)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -3537,9 +3537,9 @@ bool AsmParser::ParseDirectiveIfb(SMLoc DirectiveLoc, bool ExpectBlank) { TheCondState.TheCond = AsmCond::IfCond; if (TheCondState.Ignore) { - EatToEndOfStatement(); + eatToEndOfStatement(); } else { - StringRef Str = ParseStringToEndOfStatement(); + StringRef Str = parseStringToEndOfStatement(); if (getLexer().isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.ifb' directive"); @@ -3560,7 +3560,7 @@ bool AsmParser::ParseDirectiveIfc(SMLoc DirectiveLoc, bool ExpectEqual) { TheCondState.TheCond = AsmCond::IfCond; if (TheCondState.Ignore) { - EatToEndOfStatement(); + eatToEndOfStatement(); } else { StringRef Str1 = ParseStringToComma(); @@ -3569,7 +3569,7 @@ bool AsmParser::ParseDirectiveIfc(SMLoc DirectiveLoc, bool ExpectEqual) { Lex(); - StringRef Str2 = ParseStringToEndOfStatement(); + StringRef Str2 = parseStringToEndOfStatement(); if (getLexer().isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.ifc' directive"); @@ -3591,9 +3591,9 @@ bool AsmParser::ParseDirectiveIfdef(SMLoc DirectiveLoc, bool expect_defined) { TheCondState.TheCond = AsmCond::IfCond; if (TheCondState.Ignore) { - EatToEndOfStatement(); + eatToEndOfStatement(); } else { - if (ParseIdentifier(Name)) + if (parseIdentifier(Name)) return TokError("expected identifier after '.ifdef'"); Lex(); @@ -3624,11 +3624,11 @@ bool AsmParser::ParseDirectiveElseIf(SMLoc DirectiveLoc) { LastIgnoreState = TheCondStack.back().Ignore; if (LastIgnoreState || TheCondState.CondMet) { TheCondState.Ignore = true; - EatToEndOfStatement(); + eatToEndOfStatement(); } else { int64_t ExprValue; - if (ParseAbsoluteExpression(ExprValue)) + if (parseAbsoluteExpression(ExprValue)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -3822,7 +3822,7 @@ MCAsmMacro *AsmParser::ParseMacroLikeBody(SMLoc DirectiveLoc) { } // Otherwise, scan till the end of the statement. - EatToEndOfStatement(); + eatToEndOfStatement(); } const char *BodyStart = StartToken.getLoc().getPointer(); @@ -3858,7 +3858,7 @@ void AsmParser::InstantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc, bool AsmParser::ParseDirectiveRept(SMLoc DirectiveLoc) { int64_t Count; - if (ParseAbsoluteExpression(Count)) + if (parseAbsoluteExpression(Count)) return TokError("unexpected token in '.rept' directive"); if (Count < 0) @@ -3896,7 +3896,7 @@ bool AsmParser::ParseDirectiveIrp(SMLoc DirectiveLoc) { MCAsmMacroParameters Parameters; MCAsmMacroParameter Parameter; - if (ParseIdentifier(Parameter.first)) + if (parseIdentifier(Parameter.first)) return TokError("expected identifier in '.irp' directive"); Parameters.push_back(Parameter); @@ -3942,7 +3942,7 @@ bool AsmParser::ParseDirectiveIrpc(SMLoc DirectiveLoc) { MCAsmMacroParameters Parameters; MCAsmMacroParameter Parameter; - if (ParseIdentifier(Parameter.first)) + if (parseIdentifier(Parameter.first)) return TokError("expected identifier in '.irpc' directive"); Parameters.push_back(Parameter); @@ -4006,7 +4006,7 @@ bool AsmParser::ParseDirectiveMSEmit(SMLoc IDLoc, ParseStatementInfo &Info, size_t Len) { const MCExpr *Value; SMLoc ExprLoc = getLexer().getLoc(); - if (ParseExpression(Value)) + if (parseExpression(Value)) return true; const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value); if (!MCE) @@ -4022,7 +4022,7 @@ bool AsmParser::ParseDirectiveMSEmit(SMLoc IDLoc, ParseStatementInfo &Info, bool AsmParser::ParseDirectiveMSAlign(SMLoc IDLoc, ParseStatementInfo &Info) { const MCExpr *Value; SMLoc ExprLoc = getLexer().getLoc(); - if (ParseExpression(Value)) + if (parseExpression(Value)) return true; const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Value); if (!MCE) @@ -4063,7 +4063,7 @@ static int RewritesSort(const void *A, const void *B) { } bool -AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, +AsmParser::parseMSInlineAsm(void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl<std::pair<void *, bool> > &OpDecls, SmallVectorImpl<std::string> &Constraints, diff --git a/lib/MC/MCParser/COFFAsmParser.cpp b/lib/MC/MCParser/COFFAsmParser.cpp index d0cc0c56ce..a50eab217d 100644 --- a/lib/MC/MCParser/COFFAsmParser.cpp +++ b/lib/MC/MCParser/COFFAsmParser.cpp @@ -25,10 +25,10 @@ namespace { class COFFAsmParser : public MCAsmParserExtension { template<bool (COFFAsmParser::*HandlerMethod)(StringRef, SMLoc)> - void AddDirectiveHandler(StringRef Directive) { + void addDirectiveHandler(StringRef Directive) { MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( this, HandleDirective<COFFAsmParser, HandlerMethod>); - getParser().AddDirectiveHandler(Directive, Handler); + getParser().addDirectiveHandler(Directive, Handler); } bool ParseSectionSwitch(StringRef Section, @@ -39,43 +39,43 @@ class COFFAsmParser : public MCAsmParserExtension { // Call the base implementation. MCAsmParserExtension::Initialize(Parser); - AddDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveText>(".text"); - AddDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveData>(".data"); - AddDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveBSS>(".bss"); - AddDirectiveHandler<&COFFAsmParser::ParseDirectiveDef>(".def"); - AddDirectiveHandler<&COFFAsmParser::ParseDirectiveScl>(".scl"); - AddDirectiveHandler<&COFFAsmParser::ParseDirectiveType>(".type"); - AddDirectiveHandler<&COFFAsmParser::ParseDirectiveEndef>(".endef"); - AddDirectiveHandler<&COFFAsmParser::ParseDirectiveSecRel32>(".secrel32"); + addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveText>(".text"); + addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveData>(".data"); + addDirectiveHandler<&COFFAsmParser::ParseSectionDirectiveBSS>(".bss"); + addDirectiveHandler<&COFFAsmParser::ParseDirectiveDef>(".def"); + addDirectiveHandler<&COFFAsmParser::ParseDirectiveScl>(".scl"); + addDirectiveHandler<&COFFAsmParser::ParseDirectiveType>(".type"); + addDirectiveHandler<&COFFAsmParser::ParseDirectiveEndef>(".endef"); + addDirectiveHandler<&COFFAsmParser::ParseDirectiveSecRel32>(".secrel32"); // Win64 EH directives. - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartProc>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartProc>( ".seh_proc"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProc>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProc>( ".seh_endproc"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartChained>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveStartChained>( ".seh_startchained"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndChained>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndChained>( ".seh_endchained"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandler>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandler>( ".seh_handler"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandlerData>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveHandlerData>( ".seh_handlerdata"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushReg>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushReg>( ".seh_pushreg"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSetFrame>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSetFrame>( ".seh_setframe"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveAllocStack>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveAllocStack>( ".seh_stackalloc"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveReg>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveReg>( ".seh_savereg"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveXMM>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveSaveXMM>( ".seh_savexmm"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushFrame>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectivePushFrame>( ".seh_pushframe"); - AddDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProlog>( + addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProlog>( ".seh_endprologue"); - AddDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(".weak"); + addDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(".weak"); } bool ParseSectionDirectiveText(StringRef, SMLoc) { @@ -141,7 +141,7 @@ bool COFFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) { for (;;) { StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); @@ -177,7 +177,7 @@ bool COFFAsmParser::ParseSectionSwitch(StringRef Section, bool COFFAsmParser::ParseDirectiveDef(StringRef, SMLoc) { StringRef SymbolName; - if (getParser().ParseIdentifier(SymbolName)) + if (getParser().parseIdentifier(SymbolName)) return TokError("expected identifier in directive"); MCSymbol *Sym = getContext().GetOrCreateSymbol(SymbolName); @@ -190,7 +190,7 @@ bool COFFAsmParser::ParseDirectiveDef(StringRef, SMLoc) { bool COFFAsmParser::ParseDirectiveScl(StringRef, SMLoc) { int64_t SymbolStorageClass; - if (getParser().ParseAbsoluteExpression(SymbolStorageClass)) + if (getParser().parseAbsoluteExpression(SymbolStorageClass)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -203,7 +203,7 @@ bool COFFAsmParser::ParseDirectiveScl(StringRef, SMLoc) { bool COFFAsmParser::ParseDirectiveType(StringRef, SMLoc) { int64_t Type; - if (getParser().ParseAbsoluteExpression(Type)) + if (getParser().parseAbsoluteExpression(Type)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -222,7 +222,7 @@ bool COFFAsmParser::ParseDirectiveEndef(StringRef, SMLoc) { bool COFFAsmParser::ParseDirectiveSecRel32(StringRef, SMLoc) { StringRef SymbolID; - if (getParser().ParseIdentifier(SymbolID)) + if (getParser().parseIdentifier(SymbolID)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -237,7 +237,7 @@ bool COFFAsmParser::ParseDirectiveSecRel32(StringRef, SMLoc) { bool COFFAsmParser::ParseSEHDirectiveStartProc(StringRef, SMLoc) { StringRef SymbolID; - if (getParser().ParseIdentifier(SymbolID)) + if (getParser().parseIdentifier(SymbolID)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -270,7 +270,7 @@ bool COFFAsmParser::ParseSEHDirectiveEndChained(StringRef, SMLoc) { bool COFFAsmParser::ParseSEHDirectiveHandler(StringRef, SMLoc) { StringRef SymbolID; - if (getParser().ParseIdentifier(SymbolID)) + if (getParser().parseIdentifier(SymbolID)) return true; if (getLexer().isNot(AsmToken::Comma)) @@ -323,7 +323,7 @@ bool COFFAsmParser::ParseSEHDirectiveSetFrame(StringRef, SMLoc L) { Lex(); SMLoc startLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Off)) + if (getParser().parseAbsoluteExpression(Off)) return true; if (Off & 0x0F) @@ -340,7 +340,7 @@ bool COFFAsmParser::ParseSEHDirectiveSetFrame(StringRef, SMLoc L) { bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc) { int64_t Size; SMLoc startLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Size)) + if (getParser().parseAbsoluteExpression(Size)) return true; if (Size & 7) @@ -364,7 +364,7 @@ bool COFFAsmParser::ParseSEHDirectiveSaveReg(StringRef, SMLoc L) { Lex(); SMLoc startLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Off)) + if (getParser().parseAbsoluteExpression(Off)) return true; if (Off & 7) @@ -391,7 +391,7 @@ bool COFFAsmParser::ParseSEHDirectiveSaveXMM(StringRef, SMLoc L) { Lex(); SMLoc startLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Off)) + if (getParser().parseAbsoluteExpression(Off)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -412,7 +412,7 @@ bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc) { if (getLexer().is(AsmToken::At)) { SMLoc startLoc = getLexer().getLoc(); Lex(); - if (!getParser().ParseIdentifier(CodeID)) { + if (!getParser().parseIdentifier(CodeID)) { if (CodeID != "code") return Error(startLoc, "expected @code"); Code = true; @@ -439,7 +439,7 @@ bool COFFAsmParser::ParseAtUnwindOrAtExcept(bool &unwind, bool &except) { return TokError("a handler attribute must begin with '@'"); SMLoc startLoc = getLexer().getLoc(); Lex(); - if (getParser().ParseIdentifier(identifier)) + if (getParser().parseIdentifier(identifier)) return Error(startLoc, "expected @unwind or @except"); if (identifier == "unwind") unwind = true; @@ -480,7 +480,7 @@ bool COFFAsmParser::ParseSEHRegisterNumber(unsigned &RegNo) { } else { int64_t n; - if (getParser().ParseAbsoluteExpression(n)) + if (getParser().parseAbsoluteExpression(n)) return true; if (n > 15) return Error(startLoc, "register number is too high"); diff --git a/lib/MC/MCParser/DarwinAsmParser.cpp b/lib/MC/MCParser/DarwinAsmParser.cpp index 9029c6d085..6d6409fb69 100644 --- a/lib/MC/MCParser/DarwinAsmParser.cpp +++ b/lib/MC/MCParser/DarwinAsmParser.cpp @@ -27,10 +27,10 @@ namespace { /// Darwin targets. class DarwinAsmParser : public MCAsmParserExtension { template<bool (DarwinAsmParser::*HandlerMethod)(StringRef, SMLoc)> - void AddDirectiveHandler(StringRef Directive) { + void addDirectiveHandler(StringRef Directive) { MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( this, HandleDirective<DarwinAsmParser, HandlerMethod>); - getParser().AddDirectiveHandler(Directive, Handler); + getParser().addDirectiveHandler(Directive, Handler); } bool ParseSectionSwitch(const char *Segment, const char *Section, @@ -44,122 +44,122 @@ public: // Call the base implementation. this->MCAsmParserExtension::Initialize(Parser); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDesc>(".desc"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveLsym>(".lsym"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSubsectionsViaSymbols>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDesc>(".desc"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveLsym>(".lsym"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSubsectionsViaSymbols>( ".subsections_via_symbols"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".dump"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".load"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSection>(".section"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectivePushSection>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".dump"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDumpOrLoad>(".load"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSection>(".section"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectivePushSection>( ".pushsection"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectivePopSection>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectivePopSection>( ".popsection"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectivePrevious>(".previous"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogUnique>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectivePrevious>(".previous"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogUnique>( ".secure_log_unique"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogReset>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveSecureLogReset>( ".secure_log_reset"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveTBSS>(".tbss"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveZerofill>(".zerofill"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveTBSS>(".tbss"); + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveZerofill>(".zerofill"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegion>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegion>( ".data_region"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegionEnd>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveDataRegionEnd>( ".end_data_region"); // Special section directives. - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConst>(".const"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstData>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConst>(".const"); + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstData>( ".const_data"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstructor>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveConstructor>( ".constructor"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveCString>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveCString>( ".cstring"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveData>(".data"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDestructor>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveData>(".data"); + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDestructor>( ".destructor"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDyld>(".dyld"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit0>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveDyld>(".dyld"); + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit0>( ".fvmlib_init0"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit1>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveFVMLibInit1>( ".fvmlib_init1"); - AddDirectiveHandler< + addDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveLazySymbolPointers>( ".lazy_symbol_pointer"); - AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveLinkerOption>( + addDirectiveHandler<&DarwinAsmParser::ParseDirectiveLinkerOption>( ".linker_option"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral16>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral16>( ".literal16"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral4>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral4>( ".literal4"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral8>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral8>( ".literal8"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModInitFunc>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModInitFunc>( ".mod_init_func"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModTermFunc>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveModTermFunc>( ".mod_term_func"); - AddDirectiveHandler< + addDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveNonLazySymbolPointers>( ".non_lazy_symbol_pointer"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatClsMeth>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatClsMeth>( ".objc_cat_cls_meth"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatInstMeth>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCatInstMeth>( ".objc_cat_inst_meth"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCategory>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCCategory>( ".objc_category"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClass>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClass>( ".objc_class"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassNames>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassNames>( ".objc_class_names"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassVars>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClassVars>( ".objc_class_vars"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsMeth>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsMeth>( ".objc_cls_meth"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsRefs>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCClsRefs>( ".objc_cls_refs"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCInstMeth>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCInstMeth>( ".objc_inst_meth"); - AddDirectiveHandler< + addDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveObjCInstanceVars>( ".objc_instance_vars"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMessageRefs>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMessageRefs>( ".objc_message_refs"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMetaClass>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCMetaClass>( ".objc_meta_class"); - AddDirectiveHandler< + addDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveObjCMethVarNames>( ".objc_meth_var_names"); - AddDirectiveHandler< + addDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveObjCMethVarTypes>( ".objc_meth_var_types"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCModuleInfo>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCModuleInfo>( ".objc_module_info"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCProtocol>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCProtocol>( ".objc_protocol"); - AddDirectiveHandler< + addDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveObjCSelectorStrs>( ".objc_selector_strs"); - AddDirectiveHandler< + addDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveObjCStringObject>( ".objc_string_object"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCSymbols>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveObjCSymbols>( ".objc_symbols"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectivePICSymbolStub>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectivePICSymbolStub>( ".picsymbol_stub"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticConst>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticConst>( ".static_const"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticData>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveStaticData>( ".static_data"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveSymbolStub>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveSymbolStub>( ".symbol_stub"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTData>(".tdata"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveText>(".text"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveThreadInitFunc>( + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTData>(".tdata"); + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveText>(".text"); + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveThreadInitFunc>( ".thread_init_func"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTLV>(".tlv"); + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveTLV>(".tlv"); - AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveIdent>(".ident"); + addDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveIdent>(".ident"); } bool ParseDirectiveDesc(StringRef, SMLoc); @@ -345,7 +345,7 @@ public: } bool ParseSectionDirectiveIdent(StringRef, SMLoc) { // Darwin silently ignores the .ident directive. - getParser().EatToEndOfStatement(); + getParser().eatToEndOfStatement(); return false; } bool ParseSectionDirectiveThreadInitFunc(StringRef, SMLoc) { @@ -390,7 +390,7 @@ bool DarwinAsmParser::ParseSectionSwitch(const char *Segment, /// ::= .desc identifier , expression bool DarwinAsmParser::ParseDirectiveDesc(StringRef, SMLoc) { StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); // Handle the identifier as the key symbol. @@ -401,7 +401,7 @@ bool DarwinAsmParser::ParseDirectiveDesc(StringRef, SMLoc) { Lex(); int64_t DescValue; - if (getParser().ParseAbsoluteExpression(DescValue)) + if (getParser().parseAbsoluteExpression(DescValue)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -447,7 +447,7 @@ bool DarwinAsmParser::ParseDirectiveLinkerOption(StringRef IDVal, SMLoc) { return TokError("expected string in '" + Twine(IDVal) + "' directive"); std::string Data; - if (getParser().ParseEscapedString(Data)) + if (getParser().parseEscapedString(Data)) return true; Args.push_back(Data); @@ -469,7 +469,7 @@ bool DarwinAsmParser::ParseDirectiveLinkerOption(StringRef IDVal, SMLoc) { /// ::= .lsym identifier , expression bool DarwinAsmParser::ParseDirectiveLsym(StringRef, SMLoc) { StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); // Handle the identifier as the key symbol. @@ -480,7 +480,7 @@ bool DarwinAsmParser::ParseDirectiveLsym(StringRef, SMLoc) { Lex(); const MCExpr *Value; - if (getParser().ParseExpression(Value)) + if (getParser().parseExpression(Value)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -501,7 +501,7 @@ bool DarwinAsmParser::ParseDirectiveSection(StringRef, SMLoc) { SMLoc Loc = getLexer().getLoc(); StringRef SectionName; - if (getParser().ParseIdentifier(SectionName)) + if (getParser().parseIdentifier(SectionName)) return Error(Loc, "expected identifier after '.section' directive"); // Verify there is a following comma. @@ -576,7 +576,7 @@ bool DarwinAsmParser::ParseDirectivePrevious(StringRef DirName, SMLoc) { /// ParseDirectiveSecureLogUnique /// ::= .secure_log_unique ... message ... bool DarwinAsmParser::ParseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) { - StringRef LogMessage = getParser().ParseStringToEndOfStatement(); + StringRef LogMessage = getParser().parseStringToEndOfStatement(); if (getLexer().isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.secure_log_unique' directive"); @@ -644,7 +644,7 @@ bool DarwinAsmParser::ParseDirectiveSubsectionsViaSymbols(StringRef, SMLoc) { bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) { SMLoc IDLoc = getLexer().getLoc(); StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); // Handle the identifier as the key symbol. @@ -656,7 +656,7 @@ bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) { int64_t Size; SMLoc SizeLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Size)) + if (getParser().parseAbsoluteExpression(Size)) return true; int64_t Pow2Alignment = 0; @@ -664,7 +664,7 @@ bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) { if (getLexer().is(AsmToken::Comma)) { Lex(); Pow2AlignmentLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Pow2Alignment)) + if (getParser().parseAbsoluteExpression(Pow2Alignment)) return true; } @@ -699,7 +699,7 @@ bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) { /// , align_expression ]] bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) { StringRef Segment; - if (getParser().ParseIdentifier(Segment)) + if (getParser().parseIdentifier(Segment)) return TokError("expected segment name after '.zerofill' directive"); if (getLexer().isNot(AsmToken::Comma)) @@ -707,7 +707,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) { Lex(); StringRef Section; - if (getParser().ParseIdentifier(Section)) + if (getParser().parseIdentifier(Section)) return TokError("expected section name after comma in '.zerofill' " "directive"); @@ -727,7 +727,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) { SMLoc IDLoc = getLexer().getLoc(); StringRef IDStr; - if (getParser().ParseIdentifier(IDStr)) + if (getParser().parseIdentifier(IDStr)) return TokError("expected identifier in directive"); // handle the identifier as the key symbol. @@ -739,7 +739,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) { int64_t Size; SMLoc SizeLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Size)) + if (getParser().parseAbsoluteExpression(Size)) return true; int64_t Pow2Alignment = 0; @@ -747,7 +747,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) { if (getLexer().is(AsmToken::Comma)) { Lex(); Pow2AlignmentLoc = getLexer().getLoc(); - if (getParser().ParseAbsoluteExpression(Pow2Alignment)) + if (getParser().parseAbsoluteExpression(Pow2Alignment)) return true; } @@ -791,7 +791,7 @@ bool DarwinAsmParser::ParseDirectiveDataRegion(StringRef, SMLoc) { } StringRef RegionType; SMLoc Loc = getParser().getTok().getLoc(); - if (getParser().ParseIdentifier(RegionType)) + if (getParser().parseIdentifier(RegionType)) return TokError("expected region type after '.data_region' directive"); int Kind = StringSwitch<int>(RegionType) .Case("jt8", MCDR_DataRegionJT8) diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp index 7921abb22e..4c45e08744 100644 --- a/lib/MC/MCParser/ELFAsmParser.cpp +++ b/lib/MC/MCParser/ELFAsmParser.cpp @@ -23,11 +23,11 @@ namespace { class ELFAsmParser : public MCAsmParserExtension { template<bool (ELFAsmParser::*HandlerMethod)(StringRef, SMLoc)> - void AddDirectiveHandler(StringRef Directive) { + void addDirectiveHandler(StringRef Directive) { MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( this, HandleDirective<ELFAsmParser, HandlerMethod>); - getParser().AddDirectiveHandler(Directive, Handler); + getParser().addDirectiveHandler(Directive, Handler); } bool ParseSectionSwitch(StringRef Section, unsigned Type, @@ -43,38 +43,38 @@ public: // Call the base implementation. this->MCAsmParserExtension::Initialize(Parser); - AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveData>(".data"); - AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveText>(".text"); - AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveBSS>(".bss"); - AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveRoData>(".rodata"); - AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTData>(".tdata"); - AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTBSS>(".tbss"); - AddDirectiveHandler< + addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveData>(".data"); + addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveText>(".text"); + addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveBSS>(".bss"); + addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveRoData>(".rodata"); + addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTData>(".tdata"); + addDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveTBSS>(".tbss"); + addDirectiveHandler< &ELFAsmParser::ParseSectionDirectiveDataRel>(".data.rel"); - AddDirectiveHandler< + addDirectiveHandler< &ELFAsmParser::ParseSectionDirectiveDataRelRo>(".data.rel.ro"); - AddDirectiveHandler< + addDirectiveHandler< &ELFAsmParser::ParseSectionDirectiveDataRelRoLocal>(".data.rel.ro.local"); - AddDirectiveHandler< + addDirectiveHandler< &ELFAsmParser::ParseSectionDirectiveEhFrame>(".eh_frame"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSection>(".section"); - AddDirectiveHandler< + addDirectiveHandler<&ELFAsmParser::ParseDirectiveSection>(".section"); + addDirectiveHandler< &ELFAsmParser::ParseDirectivePushSection>(".pushsection"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectivePopSection>(".popsection"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSize>(".size"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectivePrevious>(".previous"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveType>(".type"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveIdent>(".ident"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSymver>(".symver"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveVersion>(".version"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveWeakref>(".weakref"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".weak"); - AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".local"); - AddDirectiveHandler< + addDirectiveHandler<&ELFAsmParser::ParseDirectivePopSection>(".popsection"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveSize>(".size"); + addDirectiveHandler<&ELFAsmParser::ParseDirectivePrevious>(".previous"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveType>(".type"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveIdent>(".ident"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymver>(".symver"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveVersion>(".version"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveWeakref>(".weakref"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".weak"); + addDirectiveHandler<&ELFAsmParser::ParseDirectiveSymbolAttribute>(".local"); + addDirectiveHandler< &ELFAsmParser::ParseDirectiveSymbolAttribute>(".protected"); - AddDirectiveHandler< + addDirectiveHandler< &ELFAsmParser::ParseDirectiveSymbolAttribute>(".internal"); - AddDirectiveHandler< + addDirectiveHandler< &ELFAsmParser::ParseDirectiveSymbolAttribute>(".hidden"); } @@ -169,7 +169,7 @@ bool ELFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) { for (;;) { StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); @@ -203,7 +203,7 @@ bool ELFAsmParser::ParseSectionSwitch(StringRef Section, unsigned Type, bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) { StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); MCSymbol *Sym = getContext().GetOrCreateSymbol(Name); @@ -212,7 +212,7 @@ bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) { Lex(); const MCExpr *Expr; - if (getParser().ParseExpression(Expr)) + if (getParser().parseExpression(Expr)) return true; if (getLexer().isNot(AsmToken::EndOfStatement)) @@ -224,7 +224,7 @@ bool ELFAsmParser::ParseDirectiveSize(StringRef, SMLoc) { bool ELFAsmParser::ParseSectionName(StringRef &SectionName) { // A section name can contain -, so we cannot just use - // ParseIdentifier. + // parseIdentifier. SMLoc FirstLoc = getLexer().getLoc(); unsigned Size = 0; @@ -377,14 +377,14 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) { return TokError("expected '@' or '%' before type"); Lex(); - if (getParser().ParseIdentifier(TypeName)) + if (getParser().parseIdentifier(TypeName)) return TokError("expected identifier in directive"); if (Mergeable) { if (getLexer().isNot(AsmToken::Comma)) return TokError("expected the entry size"); Lex(); - if (getParser().ParseAbsoluteExpression(Size)) + if (getParser().parseAbsoluteExpression(Size)) return true; if (Size <= 0) return TokError("entry size must be positive"); @@ -394,12 +394,12 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) { if (getLexer().isNot(AsmToken::Comma)) return TokError("expected group name"); Lex(); - if (getParser().ParseIdentifier(GroupName)) + if (getParser().parseIdentifier(GroupName)) return true; if (getLexer().is(AsmToken::Comma)) { Lex(); StringRef Linkage; - if (getParser().ParseIdentifier(Linkage)) + if (getParser().parseIdentifier(Linkage)) return true; if (Linkage != "comdat") return TokError("Linkage must be 'comdat'"); @@ -461,7 +461,7 @@ bool ELFAsmParser::ParseDirectivePrevious(StringRef DirName, SMLoc) { /// ::= .type identifier , @attribute bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) { StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); // Handle the identifier as the key symbol. @@ -479,7 +479,7 @@ bool ELFAsmParser::ParseDirectiveType(StringRef, SMLoc) { SMLoc TypeLoc; TypeLoc = getLexer().getLoc(); - if (getParser().ParseIdentifier(Type)) + if (getParser().parseIdentifier(Type)) return TokError("expected symbol type in directive"); MCSymbolAttr Attr = StringSwitch<MCSymbolAttr>(Type) @@ -538,7 +538,7 @@ bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) { /// ::= .symver foo, bar2@zed bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) { StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); if (getLexer().isNot(AsmToken::Comma)) @@ -547,7 +547,7 @@ bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) { Lex(); StringRef AliasName; - if (getParser().ParseIdentifier(AliasName)) + if (getParser().parseIdentifier(AliasName)) return TokError("expected identifier in directive"); if (AliasName.find('@') == StringRef::npos) @@ -593,7 +593,7 @@ bool ELFAsmParser::ParseDirectiveWeakref(StringRef, SMLoc) { // FIXME: Share code with the other alias building directives. StringRef AliasName; - if (getParser().ParseIdentifier(AliasName)) + if (getParser().parseIdentifier(AliasName)) return TokError("expected identifier in directive"); if (getLexer().isNot(AsmToken::Comma)) @@ -602,7 +602,7 @@ bool ELFAsmParser::ParseDirectiveWeakref(StringRef, SMLoc) { Lex(); StringRef Name; - if (getParser().ParseIdentifier(Name)) + if (getParser().parseIdentifier(Name)) return TokError("expected identifier in directive"); MCSymbol *Alias = getContext().GetOrCreateSymbol(AliasName); diff --git a/lib/MC/MCParser/MCAsmParser.cpp b/lib/MC/MCParser/MCAsmParser.cpp index a8b00cd84a..6e1ebad36c 100644 --- a/lib/MC/MCParser/MCAsmParser.cpp +++ b/lib/MC/MCParser/MCAsmParser.cpp @@ -38,9 +38,9 @@ bool MCAsmParser::TokError(const Twine &Msg, ArrayRef<SMRange> Ranges) { return true; } -bool MCAsmParser::ParseExpression(const MCExpr *&Res) { +bool MCAsmParser::parseExpression(const MCExpr *&Res) { SMLoc L; - return ParseExpression(Res, L); + return parseExpression(Res, L); } void MCParsedAsmOperand::dump() const { |