diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-06-03 22:41:23 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-06-03 22:41:23 +0000 |
commit | 28c1f666bf740a8031b46f17896dcb6579c3f181 (patch) | |
tree | 149e5bc245c4bf462469aa89b5731c0c3e9e471a /lib/MC | |
parent | a15f9d53114a86005b260cbc451b0c63aa92bc1d (diff) | |
download | external_llvm-28c1f666bf740a8031b46f17896dcb6579c3f181.zip external_llvm-28c1f666bf740a8031b46f17896dcb6579c3f181.tar.gz external_llvm-28c1f666bf740a8031b46f17896dcb6579c3f181.tar.bz2 |
Add a typedef to simplify the code a bit. Not functionality change.
Part of a patch by the PaX Team.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 7be86fd..e8a8491 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -45,6 +45,8 @@ FatalAssemblerWarnings("fatal-assembler-warnings", namespace { /// \brief Helper class for tracking macro definitions. +typedef std::vector<AsmToken> MacroArgument; + struct Macro { StringRef Name; StringRef Body; @@ -183,7 +185,7 @@ private: bool HandleMacroEntry(StringRef Name, SMLoc NameLoc, const Macro *M); bool expandMacro(SmallString<256> &Buf, StringRef Body, const std::vector<StringRef> &Parameters, - const std::vector<std::vector<AsmToken> > &A, + const std::vector<MacroArgument> &A, const SMLoc &L); void HandleMacroExit(); @@ -1438,7 +1440,7 @@ void AsmParser::DiagHandler(const SMDiagnostic &Diag, void *Context) { bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body, const std::vector<StringRef> &Parameters, - const std::vector<std::vector<AsmToken> > &A, + const std::vector<MacroArgument> &A, const SMLoc &L) { raw_svector_ostream OS(Buf); unsigned NParameters = Parameters.size(); @@ -1492,7 +1494,7 @@ bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body, break; // Otherwise substitute with the token values, with spaces eliminated. - for (std::vector<AsmToken>::const_iterator it = A[Index].begin(), + for (MacroArgument::const_iterator it = A[Index].begin(), ie = A[Index].end(); it != ie; ++it) OS << it->getString(); break; @@ -1515,7 +1517,7 @@ bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body, if (Index == NParameters) return Error(L, "Parameter not found"); - for (std::vector<AsmToken>::const_iterator it = A[Index].begin(), + for (MacroArgument::const_iterator it = A[Index].begin(), ie = A[Index].end(); it != ie; ++it) OS << it->getString(); @@ -1545,8 +1547,8 @@ bool AsmParser::HandleMacroEntry(StringRef Name, SMLoc NameLoc, return TokError("macros cannot be nested more than 20 levels deep"); // Parse the macro instantiation arguments. - std::vector<std::vector<AsmToken> > MacroArguments; - MacroArguments.push_back(std::vector<AsmToken>()); + std::vector<MacroArgument> MacroArguments; + MacroArguments.push_back(MacroArgument()); unsigned ParenLevel = 0; for (;;) { if (Lexer.is(AsmToken::Eof)) @@ -1557,7 +1559,7 @@ bool AsmParser::HandleMacroEntry(StringRef Name, SMLoc NameLoc, // If we aren't inside parentheses and this is a comma, start a new token // list. if (ParenLevel == 0 && Lexer.is(AsmToken::Comma)) { - MacroArguments.push_back(std::vector<AsmToken>()); + MacroArguments.push_back(MacroArgument()); } else { // Adjust the current parentheses level. if (Lexer.is(AsmToken::LParen)) |