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 | f7f70019ffa495ad86626322ea5c7f1793a2f53c (patch) | |
tree | 3d0ccca57a54fe10e39a2325b3acc214c58ad77a /tools | |
parent | f97e3d2379951b1e1d315a864e54826c85d546d7 (diff) | |
download | external_llvm-f7f70019ffa495ad86626322ea5c7f1793a2f53c.zip external_llvm-f7f70019ffa495ad86626322ea5c7f1793a2f53c.tar.gz external_llvm-f7f70019ffa495ad86626322ea5c7f1793a2f53c.tar.bz2 |
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')
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 24 | ||||
-rw-r--r-- | tools/llvm-mc/AsmParser.h | 1 |
2 files changed, 25 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; +} diff --git a/tools/llvm-mc/AsmParser.h b/tools/llvm-mc/AsmParser.h index 7d75637..1bb7ca2 100644 --- a/tools/llvm-mc/AsmParser.h +++ b/tools/llvm-mc/AsmParser.h @@ -119,6 +119,7 @@ private: bool ParseDirectiveDarwinSubsectionsViaSymbols(); bool ParseDirectiveAbort(); // ".abort" + bool ParseDirectiveInclude(); // ".include" }; } // end namespace llvm |