mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
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
This commit is contained in:
@ -45,6 +45,8 @@ FatalAssemblerWarnings("fatal-assembler-warnings",
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
/// \brief Helper class for tracking macro definitions.
|
/// \brief Helper class for tracking macro definitions.
|
||||||
|
typedef std::vector<AsmToken> MacroArgument;
|
||||||
|
|
||||||
struct Macro {
|
struct Macro {
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
StringRef Body;
|
StringRef Body;
|
||||||
@ -183,7 +185,7 @@ private:
|
|||||||
bool HandleMacroEntry(StringRef Name, SMLoc NameLoc, const Macro *M);
|
bool HandleMacroEntry(StringRef Name, SMLoc NameLoc, const Macro *M);
|
||||||
bool expandMacro(SmallString<256> &Buf, StringRef Body,
|
bool expandMacro(SmallString<256> &Buf, StringRef Body,
|
||||||
const std::vector<StringRef> &Parameters,
|
const std::vector<StringRef> &Parameters,
|
||||||
const std::vector<std::vector<AsmToken> > &A,
|
const std::vector<MacroArgument> &A,
|
||||||
const SMLoc &L);
|
const SMLoc &L);
|
||||||
void HandleMacroExit();
|
void HandleMacroExit();
|
||||||
|
|
||||||
@ -1438,7 +1440,7 @@ void AsmParser::DiagHandler(const SMDiagnostic &Diag, void *Context) {
|
|||||||
|
|
||||||
bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body,
|
bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body,
|
||||||
const std::vector<StringRef> &Parameters,
|
const std::vector<StringRef> &Parameters,
|
||||||
const std::vector<std::vector<AsmToken> > &A,
|
const std::vector<MacroArgument> &A,
|
||||||
const SMLoc &L) {
|
const SMLoc &L) {
|
||||||
raw_svector_ostream OS(Buf);
|
raw_svector_ostream OS(Buf);
|
||||||
unsigned NParameters = Parameters.size();
|
unsigned NParameters = Parameters.size();
|
||||||
@ -1492,7 +1494,7 @@ bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Otherwise substitute with the token values, with spaces eliminated.
|
// 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)
|
ie = A[Index].end(); it != ie; ++it)
|
||||||
OS << it->getString();
|
OS << it->getString();
|
||||||
break;
|
break;
|
||||||
@ -1515,7 +1517,7 @@ bool AsmParser::expandMacro(SmallString<256> &Buf, StringRef Body,
|
|||||||
if (Index == NParameters)
|
if (Index == NParameters)
|
||||||
return Error(L, "Parameter not found");
|
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)
|
ie = A[Index].end(); it != ie; ++it)
|
||||||
OS << it->getString();
|
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");
|
return TokError("macros cannot be nested more than 20 levels deep");
|
||||||
|
|
||||||
// Parse the macro instantiation arguments.
|
// Parse the macro instantiation arguments.
|
||||||
std::vector<std::vector<AsmToken> > MacroArguments;
|
std::vector<MacroArgument> MacroArguments;
|
||||||
MacroArguments.push_back(std::vector<AsmToken>());
|
MacroArguments.push_back(MacroArgument());
|
||||||
unsigned ParenLevel = 0;
|
unsigned ParenLevel = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (Lexer.is(AsmToken::Eof))
|
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
|
// If we aren't inside parentheses and this is a comma, start a new token
|
||||||
// list.
|
// list.
|
||||||
if (ParenLevel == 0 && Lexer.is(AsmToken::Comma)) {
|
if (ParenLevel == 0 && Lexer.is(AsmToken::Comma)) {
|
||||||
MacroArguments.push_back(std::vector<AsmToken>());
|
MacroArguments.push_back(MacroArgument());
|
||||||
} else {
|
} else {
|
||||||
// Adjust the current parentheses level.
|
// Adjust the current parentheses level.
|
||||||
if (Lexer.is(AsmToken::LParen))
|
if (Lexer.is(AsmToken::LParen))
|
||||||
|
Reference in New Issue
Block a user