MCAsmLexer.cpp 945 B

123456789101112131415161718192021222324252627282930313233343536
  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. #include "llvm/MC/MCParser/MCAsmLexer.h"
  10. #include "llvm/Support/SourceMgr.h"
  11. using namespace llvm;
  12. MCAsmLexer::MCAsmLexer() : CurTok(AsmToken::Error, StringRef()),
  13. TokStart(nullptr), SkipSpace(true) {
  14. }
  15. MCAsmLexer::~MCAsmLexer() {
  16. }
  17. SMLoc MCAsmLexer::getLoc() const {
  18. return SMLoc::getFromPointer(TokStart);
  19. }
  20. SMLoc AsmToken::getLoc() const {
  21. return SMLoc::getFromPointer(Str.data());
  22. }
  23. SMLoc AsmToken::getEndLoc() const {
  24. return SMLoc::getFromPointer(Str.data() + Str.size());
  25. }
  26. SMRange AsmToken::getLocRange() const {
  27. return SMRange(getLoc(), getEndLoc());
  28. }