MC/AsmParser: Switch some directive parsing to use accessor methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108160 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar
2010-07-12 17:45:27 +00:00
parent 53131982d6
commit eceec05c82

View File

@@ -1898,37 +1898,37 @@ bool AsmParser::ParseDirectiveEndIf(SMLoc DirectiveLoc) {
bool AsmParser::ParseDirectiveFile(StringRef, SMLoc DirectiveLoc) { bool AsmParser::ParseDirectiveFile(StringRef, SMLoc DirectiveLoc) {
// FIXME: I'm not sure what this is. // FIXME: I'm not sure what this is.
int64_t FileNumber = -1; int64_t FileNumber = -1;
if (Lexer.is(AsmToken::Integer)) { if (getLexer().is(AsmToken::Integer)) {
FileNumber = getTok().getIntVal(); FileNumber = getTok().getIntVal();
Lex(); Lex();
if (FileNumber < 1) if (FileNumber < 1)
return TokError("file number less than one"); return TokError("file number less than one");
} }
if (Lexer.isNot(AsmToken::String)) if (getLexer().isNot(AsmToken::String))
return TokError("unexpected token in '.file' directive"); return TokError("unexpected token in '.file' directive");
StringRef Filename = getTok().getString(); StringRef Filename = getTok().getString();
Filename = Filename.substr(1, Filename.size()-2); Filename = Filename.substr(1, Filename.size()-2);
Lex(); Lex();
if (Lexer.isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.file' directive"); return TokError("unexpected token in '.file' directive");
if (FileNumber == -1) if (FileNumber == -1)
Out.EmitFileDirective(Filename); getStreamer().EmitFileDirective(Filename);
else else
Out.EmitDwarfFileDirective(FileNumber, Filename); getStreamer().EmitDwarfFileDirective(FileNumber, Filename);
return false; return false;
} }
/// ParseDirectiveLine /// ParseDirectiveLine
/// ::= .line [number] /// ::= .line [number]
bool AsmParser::ParseDirectiveLine(StringRef, SMLoc DirectiveLoc) { bool AsmParser::ParseDirectiveLine(StringRef, SMLoc DirectiveLoc) {
if (Lexer.isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
if (Lexer.isNot(AsmToken::Integer)) if (getLexer().isNot(AsmToken::Integer))
return TokError("unexpected token in '.line' directive"); return TokError("unexpected token in '.line' directive");
int64_t LineNumber = getTok().getIntVal(); int64_t LineNumber = getTok().getIntVal();
@@ -1938,7 +1938,7 @@ bool AsmParser::ParseDirectiveLine(StringRef, SMLoc DirectiveLoc) {
// FIXME: Do something with the .line. // FIXME: Do something with the .line.
} }
if (Lexer.isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.line' directive"); return TokError("unexpected token in '.line' directive");
return false; return false;
@@ -1948,7 +1948,7 @@ bool AsmParser::ParseDirectiveLine(StringRef, SMLoc DirectiveLoc) {
/// ParseDirectiveLoc /// ParseDirectiveLoc
/// ::= .loc number [number [number]] /// ::= .loc number [number [number]]
bool AsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) { bool AsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) {
if (Lexer.isNot(AsmToken::Integer)) if (getLexer().isNot(AsmToken::Integer))
return TokError("unexpected token in '.loc' directive"); return TokError("unexpected token in '.loc' directive");
// FIXME: What are these fields? // FIXME: What are these fields?
@@ -1957,16 +1957,16 @@ bool AsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) {
// FIXME: Validate file. // FIXME: Validate file.
Lex(); Lex();
if (Lexer.isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
if (Lexer.isNot(AsmToken::Integer)) if (getLexer().isNot(AsmToken::Integer))
return TokError("unexpected token in '.loc' directive"); return TokError("unexpected token in '.loc' directive");
int64_t Param2 = getTok().getIntVal(); int64_t Param2 = getTok().getIntVal();
(void) Param2; (void) Param2;
Lex(); Lex();
if (Lexer.isNot(AsmToken::EndOfStatement)) { if (getLexer().isNot(AsmToken::EndOfStatement)) {
if (Lexer.isNot(AsmToken::Integer)) if (getLexer().isNot(AsmToken::Integer))
return TokError("unexpected token in '.loc' directive"); return TokError("unexpected token in '.loc' directive");
int64_t Param3 = getTok().getIntVal(); int64_t Param3 = getTok().getIntVal();
@@ -1977,7 +1977,7 @@ bool AsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) {
} }
} }
if (Lexer.isNot(AsmToken::EndOfStatement)) if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.file' directive"); return TokError("unexpected token in '.file' directive");
return false; return false;