Added llvm-mc support for parsing the .include directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75711 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index b4e0f57..1550c69 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -535,6 +535,8 @@
return ParseDirectiveDarwinSubsectionsViaSymbols();
if (!strcmp(IDVal, ".abort"))
return ParseDirectiveAbort();
+ if (!strcmp(IDVal, ".include"))
+ return ParseDirectiveInclude();
Warning(IDLoc, "ignoring directive for now");
EatToEndOfStatement();
@@ -1158,3 +1160,25 @@
return false;
}
+
+/// ParseDirectiveInclude
+/// ::= .include "filename"
+bool AsmParser::ParseDirectiveInclude() {
+ const char *Str;
+
+ if (Lexer.isNot(asmtok::String))
+ return TokError("expected string in '.include' directive");
+
+ Str = Lexer.getCurStrVal();
+
+ Lexer.Lex();
+
+ if (Lexer.isNot(asmtok::EndOfStatement))
+ return TokError("unexpected token in '.include' directive");
+
+ Lexer.Lex();
+
+ Out.SwitchInputAssemblyFile(Str);
+
+ return false;
+}