mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
2bff3a2a68
This allows clients to register an AsmCommentConsumer with the MCAsmLexer, which receives a callback each time a comment is parsed. Differential Revision: https://reviews.llvm.org/D27511 llvm-svn: 289036
39 lines
997 B
C++
39 lines
997 B
C++
//===-- 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/MC/MCParser/MCAsmLexer.h"
|
|
#include "llvm/Support/SourceMgr.h"
|
|
|
|
using namespace llvm;
|
|
|
|
MCAsmLexer::MCAsmLexer()
|
|
: TokStart(nullptr), SkipSpace(true), IsAtStartOfStatement(true),
|
|
CommentConsumer(nullptr) {
|
|
CurTok.emplace_back(AsmToken::Space, StringRef());
|
|
}
|
|
|
|
MCAsmLexer::~MCAsmLexer() {
|
|
}
|
|
|
|
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());
|
|
}
|