Eugene Zelenko | 4b6ff6b | 2017-02-10 01:33:54 +0000 | [diff] [blame] | 1 | //===- MCAsmLexer.cpp - Abstract Asm Lexer Interface ----------------------===// |
Daniel Dunbar | 2b11c7d | 2009-07-20 20:01:54 +0000 | [diff] [blame] | 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 Lattner | 00646cf | 2010-01-22 01:44:57 +0000 | [diff] [blame] | 10 | #include "llvm/MC/MCParser/MCAsmLexer.h" |
Chandler Carruth | 6bda14b | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 11 | #include "llvm/ADT/StringRef.h" |
Eugene Zelenko | 4b6ff6b | 2017-02-10 01:33:54 +0000 | [diff] [blame] | 12 | #include "llvm/Support/SMLoc.h" |
Daniel Dunbar | 2b11c7d | 2009-07-20 20:01:54 +0000 | [diff] [blame] | 13 | |
| 14 | using namespace llvm; |
| 15 | |
Michael Zuckerman | 5670461 | 2017-05-01 13:20:12 +0000 | [diff] [blame] | 16 | MCAsmLexer::MCAsmLexer() : AltMacroMode(false) { |
Nirav Dave | 1180e689 | 2016-06-02 17:15:05 +0000 | [diff] [blame] | 17 | CurTok.emplace_back(AsmToken::Space, StringRef()); |
Daniel Dunbar | 2b11c7d | 2009-07-20 20:01:54 +0000 | [diff] [blame] | 18 | } |
| 19 | |
Eugene Zelenko | 4b6ff6b | 2017-02-10 01:33:54 +0000 | [diff] [blame] | 20 | MCAsmLexer::~MCAsmLexer() = default; |
Daniel Dunbar | cbf4faf | 2009-08-14 02:18:40 +0000 | [diff] [blame] | 21 | |
Daniel Dunbar | 4042c33 | 2010-07-12 17:10:00 +0000 | [diff] [blame] | 22 | SMLoc MCAsmLexer::getLoc() const { |
| 23 | return SMLoc::getFromPointer(TokStart); |
| 24 | } |
| 25 | |
Daniel Dunbar | cbf4faf | 2009-08-14 02:18:40 +0000 | [diff] [blame] | 26 | SMLoc AsmToken::getLoc() const { |
| 27 | return SMLoc::getFromPointer(Str.data()); |
| 28 | } |
Benjamin Kramer | 1930b00 | 2011-10-16 12:10:27 +0000 | [diff] [blame] | 29 | |
| 30 | SMLoc AsmToken::getEndLoc() const { |
Jordan Rose | e8f1eae | 2013-01-07 19:00:49 +0000 | [diff] [blame] | 31 | return SMLoc::getFromPointer(Str.data() + Str.size()); |
Benjamin Kramer | 1930b00 | 2011-10-16 12:10:27 +0000 | [diff] [blame] | 32 | } |
Daniel Sanders | ef638fe | 2014-10-03 15:37:37 +0000 | [diff] [blame] | 33 | |
| 34 | SMRange AsmToken::getLocRange() const { |
| 35 | return SMRange(getLoc(), getEndLoc()); |
| 36 | } |