llvm-6502/include/llvm/MC/MCParser/MCAsmParserExtension.h
Daniel Dunbar 4e82bbb745 MCAsmParser: Add getSourceManager().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 18:35:04 +00:00

67 lines
1.9 KiB
C++

//===-- llvm/MC/MCAsmParserExtension.h - Asm Parser Hooks -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCASMPARSEREXTENSION_H
#define LLVM_MC_MCASMPARSEREXTENSION_H
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/Support/SMLoc.h"
namespace llvm {
/// \brief Generic interface for extending the MCAsmParser,
/// which is implemented by target and object file assembly parser
/// implementations.
class MCAsmParserExtension {
MCAsmParserExtension(const MCAsmParserExtension &); // DO NOT IMPLEMENT
void operator=(const MCAsmParserExtension &); // DO NOT IMPLEMENT
MCAsmParser *Parser;
protected:
MCAsmParserExtension();
public:
virtual ~MCAsmParserExtension();
/// \brief Initialize the extension for parsing using the given \arg
/// Parser. The extension should use the AsmParser interfaces to register its
/// parsing routines.
virtual void Initialize(MCAsmParser &Parser);
/// @name MCAsmParser Proxy Interfaces
/// @{
MCContext &getContext() { return getParser().getContext(); }
MCAsmLexer &getLexer() { return getParser().getLexer(); }
MCAsmParser &getParser() { return *Parser; }
SourceMgr &getSourceManager() { return getParser().getSourceManager(); }
MCStreamer &getStreamer() { return getParser().getStreamer(); }
void Warning(SMLoc L, const Twine &Msg) {
return getParser().Warning(L, Msg);
}
bool Error(SMLoc L, const Twine &Msg) {
return getParser().Error(L, Msg);
}
const AsmToken &Lex() { return getParser().Lex(); }
const AsmToken &getTok() { return getParser().getTok(); }
bool TokError(const char *Msg) {
return getParser().TokError(Msg);
}
/// @}
};
} // End llvm namespace
#endif