aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
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;
+}