From 9bac6b29b832419f8b76bb2c27af74bb57a8d99a Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Mon, 14 Jan 2013 19:00:26 +0000 Subject: Move ParseMacroArgument to the MCAsmParser interfance. Since it's used by extensions. One further step to fully decoupling GenericAsmParser from an intimate knowledge of the internals of AsmParser, pointing it to the MCASmParser interface instead (like all other parser extensions do). Since this change moves the MacroArgument type to the interface header, it's renamed to be a bit more descriptive in a general context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172449 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCParser/AsmParser.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'lib/MC/MCParser/AsmParser.cpp') diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 3621982259..752cc19132 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -51,9 +51,8 @@ MCAsmParserSemaCallback::~MCAsmParserSemaCallback() {} namespace { /// \brief Helper class for tracking macro definitions. -typedef std::vector MacroArgument; -typedef std::vector MacroArguments; -typedef std::pair MacroParameter; +typedef std::vector MacroArguments; +typedef std::pair MacroParameter; typedef std::vector MacroParameters; struct Macro { @@ -271,7 +270,7 @@ private: /// location. void JumpToLoc(SMLoc Loc, int InBuffer=-1); - bool ParseMacroArgument(MacroArgument &MA, + bool ParseMacroArgument(MCAsmMacroArgument &MA, AsmToken::TokenKind &ArgumentDelimiter); bool ParseMacroArguments(const Macro *M, MacroArguments &A); @@ -1650,7 +1649,7 @@ bool AsmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, break; // Otherwise substitute with the token values, with spaces eliminated. - for (MacroArgument::const_iterator it = A[Index].begin(), + for (MCAsmMacroArgument::const_iterator it = A[Index].begin(), ie = A[Index].end(); it != ie; ++it) OS << it->getString(); break; @@ -1677,7 +1676,7 @@ bool AsmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, Pos = I; } } else { - for (MacroArgument::const_iterator it = A[Index].begin(), + for (MCAsmMacroArgument::const_iterator it = A[Index].begin(), ie = A[Index].end(); it != ie; ++it) if (it->getKind() == AsmToken::String) OS << it->getStringContents(); @@ -1735,10 +1734,7 @@ static bool IsOperator(AsmToken::TokenKind kind) } } -/// ParseMacroArgument - Extract AsmTokens for a macro argument. -/// This is used for both default macro parameter values and the -/// arguments in macro invocations -bool AsmParser::ParseMacroArgument(MacroArgument &MA, +bool AsmParser::ParseMacroArgument(MCAsmMacroArgument &MA, AsmToken::TokenKind &ArgumentDelimiter) { unsigned ParenLevel = 0; unsigned AddTokens = 0; @@ -1825,7 +1821,7 @@ bool AsmParser::ParseMacroArguments(const Macro *M, MacroArguments &A) { // - macros defined with parameters accept at most that many of them for (unsigned Parameter = 0; !NParameters || Parameter < NParameters; ++Parameter) { - MacroArgument MA; + MCAsmMacroArgument MA; if (ParseMacroArgument(MA, ArgumentDelimiter)) return true; @@ -3814,7 +3810,7 @@ bool AsmParser::ParseDirectiveIrpc(SMLoc DirectiveLoc) { StringRef Values = A.front().front().getString(); std::size_t I, End = Values.size(); for (I = 0; I < End; ++I) { - MacroArgument Arg; + MCAsmMacroArgument Arg; Arg.push_back(AsmToken(AsmToken::Identifier, Values.slice(I, I+1))); MacroArguments Args; -- cgit v1.2.3-18-g5258