aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2009-07-15 15:30:11 +0000
committerKevin Enderby <enderby@apple.com>2009-07-15 15:30:11 +0000
commit6e68cd96b2c76c80bfff07e8121ba19691ec1276 (patch)
treef97a4cf04c01009e2b0378c123bd462b80912091 /tools/llvm-mc/AsmParser.cpp
parenta4b048668418f74dfb2399421dc54db1d999c9cd (diff)
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
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r--tools/llvm-mc/AsmParser.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 1550c69874..cb21a93bb1 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -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;
+}