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
This commit is contained in:
Kevin Enderby
2009-07-14 23:21:55 +00:00
parent 1f318e00ba
commit 1f049b24c7
5 changed files with 45 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -119,6 +119,7 @@ private:
bool ParseDirectiveDarwinSubsectionsViaSymbols();
bool ParseDirectiveAbort(); // ".abort"
bool ParseDirectiveInclude(); // ".include"
};
} // end namespace llvm