Added llvm-mc support for parsing the .dump and .load directives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75786 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2009-07-15 15:30:11 +00:00
parent a4b0486684
commit 6e68cd96b2
5 changed files with 63 additions and 0 deletions

View File

@ -537,6 +537,10 @@ bool AsmParser::ParseStatement() {
return ParseDirectiveAbort();
if (!strcmp(IDVal, ".include"))
return ParseDirectiveInclude();
if (!strcmp(IDVal, ".dump"))
return ParseDirectiveDarwinDumpOrLoad(/*IsDump=*/true);
if (!strcmp(IDVal, ".load"))
return ParseDirectiveDarwinDumpOrLoad(/*IsLoad=*/false);
Warning(IDLoc, "ignoring directive for now");
EatToEndOfStatement();
@ -1182,3 +1186,28 @@ bool AsmParser::ParseDirectiveInclude() {
return false;
}
/// ParseDirectiveDarwinDumpOrLoad
/// ::= ( .dump | .load ) "filename"
bool AsmParser::ParseDirectiveDarwinDumpOrLoad(bool IsDump) {
const char *Str;
if (Lexer.isNot(asmtok::String))
return TokError("expected string in '.dump' or '.load' directive");
Str = Lexer.getCurStrVal();
Lexer.Lex();
if (Lexer.isNot(asmtok::EndOfStatement))
return TokError("unexpected token in '.dump' or '.load' directive");
Lexer.Lex();
if (IsDump)
Out.DumpSymbolsandMacros(Str);
else
Out.LoadSymbolsandMacros(Str);
return false;
}