1 //===-- MCAsmLexer.cpp - Abstract Asm Lexer 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/MCAsmLexer.h" 11 #include "llvm/Support/SourceMgr.h" 12 13 using namespace llvm; 14 MCAsmLexer()15MCAsmLexer::MCAsmLexer() : TokStart(nullptr), SkipSpace(true) { 16 CurTok.emplace_back(AsmToken::Space, StringRef()); 17 } 18 ~MCAsmLexer()19MCAsmLexer::~MCAsmLexer() { 20 } 21 getLoc() const22SMLoc MCAsmLexer::getLoc() const { 23 return SMLoc::getFromPointer(TokStart); 24 } 25 getLoc() const26SMLoc AsmToken::getLoc() const { 27 return SMLoc::getFromPointer(Str.data()); 28 } 29 getEndLoc() const30SMLoc AsmToken::getEndLoc() const { 31 return SMLoc::getFromPointer(Str.data() + Str.size()); 32 } 33 getLocRange() const34SMRange AsmToken::getLocRange() const { 35 return SMRange(getLoc(), getEndLoc()); 36 } 37