mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
66019b69d5
Recommitting after fixing AsmParser initialization and X86 inline asm error cleanup. Allow errors to be deferred and emitted as part of clean up to simplify and shorten Assembly parser code. This will allow error messages to be emitted in helper functions and be modified by the caller which has better context. As part of this many minor cleanups to the Parser: * Unify parser cleanup on error * Add Workaround for incorrect return values in ParseDirective instances * Tighten checks on error-signifying return values for parser functions and fix in-tree TargetParsers to be more consistent with the changes. * Fix AArch64 test cases checking for spurious error messages that are now fixed. These changes should be backwards compatible with current Target Parsers so long as the error status are correctly returned in appropriate functions. Reviewers: rnk, majnemer Subscribers: aemerson, jyknight, llvm-commits Differential Revision: https://reviews.llvm.org/D24047 llvm-svn: 281762
38 lines
965 B
C++
38 lines
965 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) {
|
|
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());
|
|
}
|