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
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 1550c69..cb21a93 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -537,6 +537,10 @@
       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 @@
 
   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;
+}