From dc4c7da5d4c73bef2ce73ce0f96019457337c402 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 12 Jul 2010 17:18:45 +0000 Subject: [PATCH] MC: Move AsmParser::TokError to MCAsmParser(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108155 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/AsmParser.h | 2 -- include/llvm/MC/MCParser/MCAsmParser.h | 13 ++++++++----- lib/MC/MCParser/AsmParser.cpp | 5 ----- lib/MC/MCParser/MCAsmParser.cpp | 6 ++++++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/llvm/MC/MCParser/AsmParser.h b/include/llvm/MC/MCParser/AsmParser.h index afd001b778e..5b48757d97a 100644 --- a/include/llvm/MC/MCParser/AsmParser.h +++ b/include/llvm/MC/MCParser/AsmParser.h @@ -96,8 +96,6 @@ private: MCSymbol *CreateSymbol(StringRef Name); bool ParseStatement(); - - bool TokError(const char *Msg); void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index 7f7f1b60f67..176c3a30579 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -28,7 +28,7 @@ class MCAsmParser { void operator=(const MCAsmParser &); // DO NOT IMPLEMENT protected: // Can only create subclasses. MCAsmParser(); - + public: virtual ~MCAsmParser(); @@ -43,7 +43,7 @@ public: /// Msg. virtual void Warning(SMLoc L, const Twine &Msg) = 0; - /// Warning - Emit an error at the location \arg L, with the message \arg + /// Error - Emit an error at the location \arg L, with the message \arg /// Msg. /// /// \return The return value is always true, as an idiomatic convenience to @@ -53,10 +53,13 @@ public: /// Lex - Get the next AsmToken in the stream, possibly handling file /// inclusion first. virtual const AsmToken &Lex() = 0; - + /// getTok - Get the current AsmToken from the stream. const AsmToken &getTok(); - + + /// \brief Report an error at the current lexer location. + bool TokError(const char *Msg); + /// ParseExpression - Parse an arbitrary expression. /// /// @param Res - The value of the expression. The result is undefined @@ -64,7 +67,7 @@ public: /// @result - False on success. virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0; bool ParseExpression(const MCExpr *&Res); - + /// ParseParenExpression - Parse an arbitrary expression, assuming that an /// initial '(' has already been consumed. /// diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 775075cf975..a8f2bbddb67 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -56,11 +56,6 @@ bool AsmParser::Error(SMLoc L, const Twine &Msg) { return true; } -bool AsmParser::TokError(const char *Msg) { - PrintMessage(Lexer.getLoc(), Msg, "error"); - return true; -} - void AsmParser::PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const { SrcMgr.PrintMessage(Loc, Msg, Type); diff --git a/lib/MC/MCParser/MCAsmParser.cpp b/lib/MC/MCParser/MCAsmParser.cpp index b8c20544f58..bee30641c7f 100644 --- a/lib/MC/MCParser/MCAsmParser.cpp +++ b/lib/MC/MCParser/MCAsmParser.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCParser/MCAsmParser.h" +#include "llvm/ADT/Twine.h" #include "llvm/MC/MCParser/MCAsmLexer.h" #include "llvm/MC/MCParser/MCParsedAsmOperand.h" #include "llvm/Support/SourceMgr.h" @@ -23,6 +24,11 @@ const AsmToken &MCAsmParser::getTok() { return getLexer().getTok(); } +bool MCAsmParser::TokError(const char *Msg) { + Error(getLexer().getLoc(), Msg); + return true; +} + bool MCAsmParser::ParseExpression(const MCExpr *&Res) { SMLoc L; return ParseExpression(Res, L); -- 2.34.1