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 
15 MCAsmLexer::MCAsmLexer()
16     : TokStart(nullptr), SkipSpace(true), IsAtStartOfStatement(true),
17       CommentConsumer(nullptr) {
18   CurTok.emplace_back(AsmToken::Space, StringRef());
19 }
20 
21 MCAsmLexer::~MCAsmLexer() {
22 }
23 
24 SMLoc MCAsmLexer::getLoc() const {
25   return SMLoc::getFromPointer(TokStart);
26 }
27 
28 SMLoc AsmToken::getLoc() const {
29   return SMLoc::getFromPointer(Str.data());
30 }
31 
32 SMLoc AsmToken::getEndLoc() const {
33   return SMLoc::getFromPointer(Str.data() + Str.size());
34 }
35 
36 SMRange AsmToken::getLocRange() const {
37   return SMRange(getLoc(), getEndLoc());
38 }
39