LLVM API Documentation
00001 //===-- MCAsmParser.cpp - Abstract Asm Parser Interface -------------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #include "llvm/MC/MCParser/MCAsmParser.h" 00011 #include "llvm/ADT/Twine.h" 00012 #include "llvm/MC/MCParser/MCAsmLexer.h" 00013 #include "llvm/MC/MCParser/MCParsedAsmOperand.h" 00014 #include "llvm/MC/MCTargetAsmParser.h" 00015 #include "llvm/Support/Debug.h" 00016 #include "llvm/Support/SourceMgr.h" 00017 #include "llvm/Support/raw_ostream.h" 00018 using namespace llvm; 00019 00020 MCAsmParser::MCAsmParser() : TargetParser(nullptr), ShowParsedOperands(0) { 00021 } 00022 00023 MCAsmParser::~MCAsmParser() { 00024 } 00025 00026 void MCAsmParser::setTargetParser(MCTargetAsmParser &P) { 00027 assert(!TargetParser && "Target parser is already initialized!"); 00028 TargetParser = &P; 00029 TargetParser->Initialize(*this); 00030 } 00031 00032 const AsmToken &MCAsmParser::getTok() { 00033 return getLexer().getTok(); 00034 } 00035 00036 bool MCAsmParser::TokError(const Twine &Msg, ArrayRef<SMRange> Ranges) { 00037 Error(getLexer().getLoc(), Msg, Ranges); 00038 return true; 00039 } 00040 00041 bool MCAsmParser::parseExpression(const MCExpr *&Res) { 00042 SMLoc L; 00043 return parseExpression(Res, L); 00044 } 00045 00046 void MCParsedAsmOperand::dump() const { 00047 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 00048 dbgs() << " " << *this; 00049 #endif 00050 }