diff options
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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 @@ 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; +} |