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/MC/MCTargetAsmParser.h" 15#include "llvm/Support/Debug.h" 16#include "llvm/Support/SourceMgr.h" 17#include "llvm/Support/raw_ostream.h" 18using namespace llvm; 19 20MCAsmParser::MCAsmParser() : TargetParser(0), ShowParsedOperands(0) { 21} 22 23MCAsmParser::~MCAsmParser() { 24} 25 26void MCAsmParser::setTargetParser(MCTargetAsmParser &P) { 27 assert(!TargetParser && "Target parser is already initialized!"); 28 TargetParser = &P; 29 TargetParser->Initialize(*this); 30} 31 32const AsmToken &MCAsmParser::getTok() { 33 return getLexer().getTok(); 34} 35 36bool MCAsmParser::TokError(const Twine &Msg, ArrayRef<SMRange> Ranges) { 37 Error(getLexer().getLoc(), Msg, Ranges); 38 return true; 39} 40 41bool MCAsmParser::parseExpression(const MCExpr *&Res) { 42 SMLoc L; 43 return parseExpression(Res, L); 44} 45 46void MCParsedAsmOperand::dump() const { 47#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 48 dbgs() << " " << *this; 49#endif 50} 51