mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
Rename TGSourceMgr -> SourceMgr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,8 +13,8 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef TGSOURCEMGR_H
|
#ifndef SUPPORT_SOURCEMGR_H
|
||||||
#define TGSOURCEMGR_H
|
#define SUPPORT_SOURCEMGR_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class MemoryBuffer;
|
class MemoryBuffer;
|
||||||
class TGSourceMgr;
|
class SourceMgr;
|
||||||
|
|
||||||
class SMLoc {
|
class SMLoc {
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
@@ -42,9 +42,9 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// TGSourceMgr - This owns the files read by tblgen, handles include stacks,
|
/// SourceMgr - This owns the files read by tblgen, handles include stacks,
|
||||||
/// and handles printing of diagnostics.
|
/// and handles printing of diagnostics.
|
||||||
class TGSourceMgr {
|
class SourceMgr {
|
||||||
struct SrcBuffer {
|
struct SrcBuffer {
|
||||||
/// Buffer - The memory buffer for the file.
|
/// Buffer - The memory buffer for the file.
|
||||||
MemoryBuffer *Buffer;
|
MemoryBuffer *Buffer;
|
||||||
@@ -57,11 +57,11 @@ class TGSourceMgr {
|
|||||||
/// Buffers - This is all of the buffers that we are reading from.
|
/// Buffers - This is all of the buffers that we are reading from.
|
||||||
std::vector<SrcBuffer> Buffers;
|
std::vector<SrcBuffer> Buffers;
|
||||||
|
|
||||||
TGSourceMgr(const TGSourceMgr&); // DO NOT IMPLEMENT
|
SourceMgr(const SourceMgr&); // DO NOT IMPLEMENT
|
||||||
void operator=(const TGSourceMgr&); // DO NOT IMPLEMENT
|
void operator=(const SourceMgr&); // DO NOT IMPLEMENT
|
||||||
public:
|
public:
|
||||||
TGSourceMgr() {}
|
SourceMgr() {}
|
||||||
~TGSourceMgr();
|
~SourceMgr();
|
||||||
|
|
||||||
const SrcBuffer &getBufferInfo(unsigned i) const {
|
const SrcBuffer &getBufferInfo(unsigned i) const {
|
||||||
assert(i < Buffers.size() && "Invalid Buffer ID!");
|
assert(i < Buffers.size() && "Invalid Buffer ID!");
|
||||||
|
@@ -19,6 +19,7 @@ add_llvm_library(LLVMSupport
|
|||||||
PrettyStackTrace.cpp
|
PrettyStackTrace.cpp
|
||||||
SlowOperationInformer.cpp
|
SlowOperationInformer.cpp
|
||||||
SmallPtrSet.cpp
|
SmallPtrSet.cpp
|
||||||
|
SourceMgr.cpp
|
||||||
Statistic.cpp
|
Statistic.cpp
|
||||||
Streams.cpp
|
Streams.cpp
|
||||||
StringExtras.cpp
|
StringExtras.cpp
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
TGSourceMgr::~TGSourceMgr() {
|
SourceMgr::~SourceMgr() {
|
||||||
while (!Buffers.empty()) {
|
while (!Buffers.empty()) {
|
||||||
delete Buffers.back().Buffer;
|
delete Buffers.back().Buffer;
|
||||||
Buffers.pop_back();
|
Buffers.pop_back();
|
||||||
@@ -27,7 +27,7 @@ TGSourceMgr::~TGSourceMgr() {
|
|||||||
|
|
||||||
/// FindBufferContainingLoc - Return the ID of the buffer containing the
|
/// FindBufferContainingLoc - Return the ID of the buffer containing the
|
||||||
/// specified location, returning -1 if not found.
|
/// specified location, returning -1 if not found.
|
||||||
int TGSourceMgr::FindBufferContainingLoc(SMLoc Loc) const {
|
int SourceMgr::FindBufferContainingLoc(SMLoc Loc) const {
|
||||||
for (unsigned i = 0, e = Buffers.size(); i != e; ++i)
|
for (unsigned i = 0, e = Buffers.size(); i != e; ++i)
|
||||||
if (Loc.getPointer() >= Buffers[i].Buffer->getBufferStart() &&
|
if (Loc.getPointer() >= Buffers[i].Buffer->getBufferStart() &&
|
||||||
// Use <= here so that a pointer to the null at the end of the buffer
|
// Use <= here so that a pointer to the null at the end of the buffer
|
||||||
@@ -39,7 +39,7 @@ int TGSourceMgr::FindBufferContainingLoc(SMLoc Loc) const {
|
|||||||
|
|
||||||
/// FindLineNumber - Find the line number for the specified location in the
|
/// FindLineNumber - Find the line number for the specified location in the
|
||||||
/// specified file. This is not a fast method.
|
/// specified file. This is not a fast method.
|
||||||
unsigned TGSourceMgr::FindLineNumber(SMLoc Loc, int BufferID) const {
|
unsigned SourceMgr::FindLineNumber(SMLoc Loc, int BufferID) const {
|
||||||
if (BufferID == -1) BufferID = FindBufferContainingLoc(Loc);
|
if (BufferID == -1) BufferID = FindBufferContainingLoc(Loc);
|
||||||
assert(BufferID != -1 && "Invalid Location!");
|
assert(BufferID != -1 && "Invalid Location!");
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ unsigned TGSourceMgr::FindLineNumber(SMLoc Loc, int BufferID) const {
|
|||||||
return LineNo;
|
return LineNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TGSourceMgr::PrintIncludeStack(SMLoc IncludeLoc) const {
|
void SourceMgr::PrintIncludeStack(SMLoc IncludeLoc) const {
|
||||||
if (IncludeLoc == SMLoc()) return; // Top of stack.
|
if (IncludeLoc == SMLoc()) return; // Top of stack.
|
||||||
|
|
||||||
int CurBuf = FindBufferContainingLoc(IncludeLoc);
|
int CurBuf = FindBufferContainingLoc(IncludeLoc);
|
||||||
@@ -70,7 +70,7 @@ void TGSourceMgr::PrintIncludeStack(SMLoc IncludeLoc) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TGSourceMgr::PrintError(SMLoc ErrorLoc, const std::string &Msg) const {
|
void SourceMgr::PrintError(SMLoc ErrorLoc, const std::string &Msg) const {
|
||||||
raw_ostream &OS = errs();
|
raw_ostream &OS = errs();
|
||||||
|
|
||||||
// First thing to do: find the current buffer containing the specified
|
// First thing to do: find the current buffer containing the specified
|
||||||
|
@@ -17,7 +17,6 @@ add_executable(tblgen
|
|||||||
SubtargetEmitter.cpp
|
SubtargetEmitter.cpp
|
||||||
TGLexer.cpp
|
TGLexer.cpp
|
||||||
TGParser.cpp
|
TGParser.cpp
|
||||||
TGSourceMgr.cpp
|
|
||||||
TGValueTypes.cpp
|
TGValueTypes.cpp
|
||||||
TableGen.cpp
|
TableGen.cpp
|
||||||
TableGenBackend.cpp
|
TableGenBackend.cpp
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
TGLexer::TGLexer(TGSourceMgr &SM) : SrcMgr(SM) {
|
TGLexer::TGLexer(SourceMgr &SM) : SrcMgr(SM) {
|
||||||
CurBuffer = 0;
|
CurBuffer = 0;
|
||||||
CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
|
CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
|
||||||
CurPtr = CurBuf->getBufferStart();
|
CurPtr = CurBuf->getBufferStart();
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class MemoryBuffer;
|
class MemoryBuffer;
|
||||||
class TGSourceMgr;
|
class SourceMgr;
|
||||||
class SMLoc;
|
class SMLoc;
|
||||||
|
|
||||||
namespace tgtok {
|
namespace tgtok {
|
||||||
@@ -58,7 +58,7 @@ namespace tgtok {
|
|||||||
|
|
||||||
/// TGLexer - TableGen Lexer class.
|
/// TGLexer - TableGen Lexer class.
|
||||||
class TGLexer {
|
class TGLexer {
|
||||||
TGSourceMgr &SrcMgr;
|
SourceMgr &SrcMgr;
|
||||||
|
|
||||||
const char *CurPtr;
|
const char *CurPtr;
|
||||||
const MemoryBuffer *CurBuf;
|
const MemoryBuffer *CurBuf;
|
||||||
@@ -77,7 +77,7 @@ class TGLexer {
|
|||||||
// include files in.
|
// include files in.
|
||||||
std::vector<std::string> IncludeDirectories;
|
std::vector<std::string> IncludeDirectories;
|
||||||
public:
|
public:
|
||||||
TGLexer(TGSourceMgr &SrcMgr);
|
TGLexer(SourceMgr &SrcMgr);
|
||||||
~TGLexer() {}
|
~TGLexer() {}
|
||||||
|
|
||||||
void setIncludeDirs(const std::vector<std::string> &Dirs) {
|
void setIncludeDirs(const std::vector<std::string> &Dirs) {
|
||||||
|
@@ -47,7 +47,7 @@ class TGParser {
|
|||||||
/// current value.
|
/// current value.
|
||||||
MultiClass *CurMultiClass;
|
MultiClass *CurMultiClass;
|
||||||
public:
|
public:
|
||||||
TGParser(TGSourceMgr &SrcMgr) : Lex(SrcMgr), CurMultiClass(0) {}
|
TGParser(SourceMgr &SrcMgr) : Lex(SrcMgr), CurMultiClass(0) {}
|
||||||
|
|
||||||
void setIncludeDirs(const std::vector<std::string> &D){Lex.setIncludeDirs(D);}
|
void setIncludeDirs(const std::vector<std::string> &D){Lex.setIncludeDirs(D);}
|
||||||
|
|
||||||
|
@@ -124,7 +124,7 @@ namespace {
|
|||||||
// FIXME: Eliminate globals from tblgen.
|
// FIXME: Eliminate globals from tblgen.
|
||||||
RecordKeeper llvm::Records;
|
RecordKeeper llvm::Records;
|
||||||
|
|
||||||
static TGSourceMgr SrcMgr;
|
static SourceMgr SrcMgr;
|
||||||
|
|
||||||
void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) {
|
void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) {
|
||||||
SrcMgr.PrintError(ErrorLoc, Msg);
|
SrcMgr.PrintError(ErrorLoc, Msg);
|
||||||
@@ -136,7 +136,7 @@ void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) {
|
|||||||
/// file.
|
/// file.
|
||||||
static bool ParseFile(const std::string &Filename,
|
static bool ParseFile(const std::string &Filename,
|
||||||
const std::vector<std::string> &IncludeDirs,
|
const std::vector<std::string> &IncludeDirs,
|
||||||
TGSourceMgr &SrcMgr) {
|
SourceMgr &SrcMgr) {
|
||||||
std::string ErrorStr;
|
std::string ErrorStr;
|
||||||
MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr);
|
MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr);
|
||||||
if (F == 0) {
|
if (F == 0) {
|
||||||
|
Reference in New Issue
Block a user