aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2009-07-14 23:21:55 +0000
committerKevin Enderby <enderby@apple.com>2009-07-14 23:21:55 +0000
commit1f049b24c7e520ecfd2291b7d30eb5abc3aee852 (patch)
tree3d0ccca57a54fe10e39a2325b3acc214c58ad77a /tools/llvm-mc/AsmParser.cpp
parent1f318e00bad8b7499ef14d5732bcbda89243ec89 (diff)
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
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r--tools/llvm-mc/AsmParser.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index b4e0f5792a..1550c69874 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -535,6 +535,8 @@ bool AsmParser::ParseStatement() {
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 @@ bool AsmParser::ParseDirectiveDarwinLsym() {
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;
+}