diff options
| author | Kevin Enderby <enderby@apple.com> | 2009-07-14 23:21:55 +0000 |
|---|---|---|
| committer | Kevin Enderby <enderby@apple.com> | 2009-07-14 23:21:55 +0000 |
| commit | d1ea5393c916f08f059dbf363b0e2f91488daea0 (patch) | |
| tree | 899c8f0dfaa3c7f3d7b1959243db947ba294c36b /llvm/tools/llvm-mc/AsmParser.cpp | |
| parent | 9a797db199d1b619d9845e3f1211c4c29efc4858 (diff) | |
| download | bcm5719-llvm-d1ea5393c916f08f059dbf363b0e2f91488daea0.tar.gz bcm5719-llvm-d1ea5393c916f08f059dbf363b0e2f91488daea0.zip | |
Added llvm-mc support for parsing the .include directive.
llvm-svn: 75711
Diffstat (limited to 'llvm/tools/llvm-mc/AsmParser.cpp')
| -rw-r--r-- | llvm/tools/llvm-mc/AsmParser.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp index b4e0f5792aa..1550c698744 100644 --- a/llvm/tools/llvm-mc/AsmParser.cpp +++ b/llvm/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; +} |

