aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCParser/MCAsmLexer.cpp
blob: f8fe78aece0cacd11c43581f330840ea1d3f244b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//===- MCAsmLexer.cpp - Abstract Asm Lexer Interface ----------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/Support/SMLoc.h"

using namespace llvm;

MCAsmLexer::MCAsmLexer() {
  CurTok.emplace_back(AsmToken::Space, StringRef());
}

MCAsmLexer::~MCAsmLexer() = default;

SMLoc MCAsmLexer::getLoc() const {
  return SMLoc::getFromPointer(TokStart);
}

SMLoc AsmToken::getLoc() const {
  return SMLoc::getFromPointer(Str.data());
}

SMLoc AsmToken::getEndLoc() const {
  return SMLoc::getFromPointer(Str.data() + Str.size());
}

SMRange AsmToken::getLocRange() const {
  return SMRange(getLoc(), getEndLoc());
}