MC/AsmParser: Fix TokError() to accept a Twine.
[oota-llvm.git] / lib / MC / MCParser / MCAsmParser.cpp
1 //===-- MCAsmParser.cpp - Abstract Asm Parser Interface -------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/MC/MCParser/MCAsmParser.h"
11 #include "llvm/ADT/Twine.h"
12 #include "llvm/MC/MCParser/MCAsmLexer.h"
13 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
14 #include "llvm/Support/SourceMgr.h"
15 #include "llvm/Target/TargetAsmParser.h"
16 using namespace llvm;
17
18 MCAsmParser::MCAsmParser() : TargetParser(0) {
19 }
20
21 MCAsmParser::~MCAsmParser() {
22 }
23
24 void MCAsmParser::setTargetParser(TargetAsmParser &P) {
25   assert(!TargetParser && "Target parser is already initialized!");
26   TargetParser = &P;
27   TargetParser->Initialize(*this);
28 }
29
30 const AsmToken &MCAsmParser::getTok() {
31   return getLexer().getTok();
32 }
33
34 bool MCAsmParser::TokError(const Twine &Msg) {
35   Error(getLexer().getLoc(), Msg);
36   return true;
37 }
38
39 bool MCAsmParser::ParseExpression(const MCExpr *&Res) {
40   SMLoc L;
41   return ParseExpression(Res, L);
42 }
43
44 /// getStartLoc - Get the location of the first token of this operand.
45 SMLoc MCParsedAsmOperand::getStartLoc() const { return SMLoc(); }
46 SMLoc MCParsedAsmOperand::getEndLoc() const { return SMLoc(); }
47
48