blob: 384b341bc7300f08db7720720c188db57f18d7c9 [file] [log] [blame]
Daniel Dunbardbd692a2009-07-20 20:01:54 +00001//===-- 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
Chris Lattnerc6ef2772010-01-22 01:44:57 +000010#include "llvm/MC/MCParser/MCAsmLexer.h"
Daniel Dunbar7b7f5142009-08-14 02:18:40 +000011#include "llvm/Support/SourceMgr.h"
Daniel Dunbardbd692a2009-07-20 20:01:54 +000012
13using namespace llvm;
14
Preston Gurd7b6f2032012-09-19 20:36:12 +000015MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()),
16 TokStart(0), SkipSpace(true) {
Daniel Dunbardbd692a2009-07-20 20:01:54 +000017}
18
19MCAsmLexer::~MCAsmLexer() {
20}
Daniel Dunbar7b7f5142009-08-14 02:18:40 +000021
Daniel Dunbarca90dc62010-07-12 17:10:00 +000022SMLoc MCAsmLexer::getLoc() const {
23 return SMLoc::getFromPointer(TokStart);
24}
25
Daniel Dunbar7b7f5142009-08-14 02:18:40 +000026SMLoc AsmToken::getLoc() const {
27 return SMLoc::getFromPointer(Str.data());
28}
Benjamin Kramer5efabcf2011-10-16 12:10:27 +000029
30SMLoc AsmToken::getEndLoc() const {
31 return SMLoc::getFromPointer(Str.data() + Str.size() - 1);
32}