summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-21 03:39:35 +0000
committerChris Lattner <sabre@nondot.org>2009-06-21 03:39:35 +0000
commit1e3a8a492471f5dc3f50452af9eb9a2dfb1aeb39 (patch)
tree9807365601608606d75dde97683796089a20187c /utils
parent099e198ae84c1a6cfe2a7c79ee9f47fa67caac8f (diff)
rename TGLoc -> SMLoc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/Record.h16
-rw-r--r--utils/TableGen/TGLexer.cpp14
-rw-r--r--utils/TableGen/TGLexer.h6
-rw-r--r--utils/TableGen/TGParser.cpp40
-rw-r--r--utils/TableGen/TGParser.h12
-rw-r--r--utils/TableGen/TableGen.cpp4
6 files changed, 46 insertions, 46 deletions
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h
index 18b10eabdc0..5f45ea09caf 100644
--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -1214,19 +1214,19 @@ inline std::ostream &operator<<(std::ostream &OS, const RecordVal &RV) {
class Record {
std::string Name;
- TGLoc Loc;
+ SMLoc Loc;
std::vector<std::string> TemplateArgs;
std::vector<RecordVal> Values;
std::vector<Record*> SuperClasses;
public:
- explicit Record(const std::string &N, TGLoc loc) : Name(N), Loc(loc) {}
+ explicit Record(const std::string &N, SMLoc loc) : Name(N), Loc(loc) {}
~Record() {}
const std::string &getName() const { return Name; }
void setName(const std::string &Name); // Also updates RecordKeeper.
- TGLoc getLoc() const { return Loc; }
+ SMLoc getLoc() const { return Loc; }
const std::vector<std::string> &getTemplateArgs() const {
return TemplateArgs;
@@ -1381,7 +1381,7 @@ struct MultiClass {
void dump() const;
- MultiClass(const std::string &Name, TGLoc Loc) : Rec(Name, Loc) {}
+ MultiClass(const std::string &Name, SMLoc Loc) : Rec(Name, Loc) {}
};
class RecordKeeper {
@@ -1461,12 +1461,12 @@ struct LessRecordFieldName {
class TGError {
- TGLoc Loc;
+ SMLoc Loc;
std::string Message;
public:
- TGError(TGLoc loc, const std::string &message) : Loc(loc), Message(message) {}
+ TGError(SMLoc loc, const std::string &message) : Loc(loc), Message(message) {}
- TGLoc getLoc() const { return Loc; }
+ SMLoc getLoc() const { return Loc; }
const std::string &getMessage() const { return Message; }
};
@@ -1475,7 +1475,7 @@ std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK);
extern RecordKeeper Records;
-void PrintError(TGLoc ErrorLoc, const std::string &Msg);
+void PrintError(SMLoc ErrorLoc, const std::string &Msg);
} // End llvm namespace
diff --git a/utils/TableGen/TGLexer.cpp b/utils/TableGen/TGLexer.cpp
index 1941a599e8b..2f619e4db09 100644
--- a/utils/TableGen/TGLexer.cpp
+++ b/utils/TableGen/TGLexer.cpp
@@ -31,8 +31,8 @@ TGLexer::TGLexer(TGSourceMgr &SM) : SrcMgr(SM) {
TokStart = 0;
}
-TGLoc TGLexer::getLoc() const {
- return TGLoc::getFromPointer(TokStart);
+SMLoc TGLexer::getLoc() const {
+ return SMLoc::getFromPointer(TokStart);
}
@@ -45,10 +45,10 @@ tgtok::TokKind TGLexer::ReturnError(const char *Loc, const std::string &Msg) {
void TGLexer::PrintError(const char *Loc, const std::string &Msg) const {
- SrcMgr.PrintError(TGLoc::getFromPointer(Loc), Msg);
+ SrcMgr.PrintError(SMLoc::getFromPointer(Loc), Msg);
}
-void TGLexer::PrintError(TGLoc Loc, const std::string &Msg) const {
+void TGLexer::PrintError(SMLoc Loc, const std::string &Msg) const {
SrcMgr.PrintError(Loc, Msg);
}
@@ -66,8 +66,8 @@ int TGLexer::getNextChar() {
// If this is the end of an included file, pop the parent file off the
// include stack.
- TGLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);
- if (ParentIncludeLoc != TGLoc()) {
+ SMLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);
+ if (ParentIncludeLoc != SMLoc()) {
CurBuffer = SrcMgr.FindBufferContainingLoc(ParentIncludeLoc);
CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
CurPtr = ParentIncludeLoc.getPointer();
@@ -293,7 +293,7 @@ bool TGLexer::LexInclude() {
}
// Save the line number and lex buffer of the includer.
- CurBuffer = SrcMgr.AddNewSourceBuffer(NewBuf, TGLoc::getFromPointer(CurPtr));
+ CurBuffer = SrcMgr.AddNewSourceBuffer(NewBuf, SMLoc::getFromPointer(CurPtr));
CurBuf = NewBuf;
CurPtr = CurBuf->getBufferStart();
diff --git a/utils/TableGen/TGLexer.h b/utils/TableGen/TGLexer.h
index ac3b9840039..82f312a3388 100644
--- a/utils/TableGen/TGLexer.h
+++ b/utils/TableGen/TGLexer.h
@@ -23,7 +23,7 @@
namespace llvm {
class MemoryBuffer;
class TGSourceMgr;
-class TGLoc;
+class SMLoc;
namespace tgtok {
enum TokKind {
@@ -101,10 +101,10 @@ public:
return CurIntVal;
}
- TGLoc getLoc() const;
+ SMLoc getLoc() const;
void PrintError(const char *Loc, const std::string &Msg) const;
- void PrintError(TGLoc Loc, const std::string &Msg) const;
+ void PrintError(SMLoc Loc, const std::string &Msg) const;
private:
/// LexToken - Read the next token and return its code.
diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp
index cdd285703be..28ebdb58c0f 100644
--- a/utils/TableGen/TGParser.cpp
+++ b/utils/TableGen/TGParser.cpp
@@ -26,7 +26,7 @@ using namespace llvm;
namespace llvm {
struct SubClassReference {
- TGLoc RefLoc;
+ SMLoc RefLoc;
Record *Rec;
std::vector<Init*> TemplateArgs;
SubClassReference() : Rec(0) {}
@@ -35,7 +35,7 @@ struct SubClassReference {
};
struct SubMultiClassReference {
- TGLoc RefLoc;
+ SMLoc RefLoc;
MultiClass *MC;
std::vector<Init*> TemplateArgs;
SubMultiClassReference() : MC(0) {}
@@ -60,7 +60,7 @@ void SubMultiClassReference::dump() const {
} // end namespace llvm
-bool TGParser::AddValue(Record *CurRec, TGLoc Loc, const RecordVal &RV) {
+bool TGParser::AddValue(Record *CurRec, SMLoc Loc, const RecordVal &RV) {
if (CurRec == 0)
CurRec = &CurMultiClass->Rec;
@@ -79,7 +79,7 @@ bool TGParser::AddValue(Record *CurRec, TGLoc Loc, const RecordVal &RV) {
/// SetValue -
/// Return true on error, false on success.
-bool TGParser::SetValue(Record *CurRec, TGLoc Loc, const std::string &ValName,
+bool TGParser::SetValue(Record *CurRec, SMLoc Loc, const std::string &ValName,
const std::vector<unsigned> &BitList, Init *V) {
if (!V) return false;
@@ -527,7 +527,7 @@ bool TGParser::ParseOptionalRangeList(std::vector<unsigned> &Ranges) {
if (Lex.getCode() != tgtok::less)
return false;
- TGLoc StartLoc = Lex.getLoc();
+ SMLoc StartLoc = Lex.getLoc();
Lex.Lex(); // eat the '<'
// Parse the range list.
@@ -549,7 +549,7 @@ bool TGParser::ParseOptionalBitList(std::vector<unsigned> &Ranges) {
if (Lex.getCode() != tgtok::l_brace)
return false;
- TGLoc StartLoc = Lex.getLoc();
+ SMLoc StartLoc = Lex.getLoc();
Lex.Lex(); // eat the '{'
// Parse the range list.
@@ -634,7 +634,7 @@ RecTy *TGParser::ParseType() {
Init *TGParser::ParseIDValue(Record *CurRec) {
assert(Lex.getCode() == tgtok::Id && "Expected ID in ParseIDValue");
std::string Name = Lex.getCurStrVal();
- TGLoc Loc = Lex.getLoc();
+ SMLoc Loc = Lex.getLoc();
Lex.Lex();
return ParseIDValue(CurRec, Name, Loc);
}
@@ -642,7 +642,7 @@ Init *TGParser::ParseIDValue(Record *CurRec) {
/// ParseIDValue - This is just like ParseIDValue above, but it assumes the ID
/// has already been read.
Init *TGParser::ParseIDValue(Record *CurRec,
- const std::string &Name, TGLoc NameLoc) {
+ const std::string &Name, SMLoc NameLoc) {
if (CurRec) {
if (const RecordVal *RV = CurRec->getValue(Name))
return new VarInit(Name, RV->getType());
@@ -1041,7 +1041,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType) {
R = new CodeInit(Lex.getCurStrVal()); Lex.Lex(); break;
case tgtok::question: R = new UnsetInit(); Lex.Lex(); break;
case tgtok::Id: {
- TGLoc NameLoc = Lex.getLoc();
+ SMLoc NameLoc = Lex.getLoc();
std::string Name = Lex.getCurStrVal();
if (Lex.Lex() != tgtok::less) // consume the Id.
return ParseIDValue(CurRec, Name, NameLoc); // Value ::= IDValue
@@ -1087,7 +1087,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType) {
return new DefInit(NewRec);
}
case tgtok::l_brace: { // Value ::= '{' ValueList '}'
- TGLoc BraceLoc = Lex.getLoc();
+ SMLoc BraceLoc = Lex.getLoc();
Lex.Lex(); // eat the '{'
std::vector<Init*> Vals;
@@ -1295,7 +1295,7 @@ Init *TGParser::ParseValue(Record *CurRec, RecTy *ItemType) {
switch (Lex.getCode()) {
default: return Result;
case tgtok::l_brace: {
- TGLoc CurlyLoc = Lex.getLoc();
+ SMLoc CurlyLoc = Lex.getLoc();
Lex.Lex(); // eat the '{'
std::vector<unsigned> Ranges = ParseRangeList();
if (Ranges.empty()) return 0;
@@ -1317,7 +1317,7 @@ Init *TGParser::ParseValue(Record *CurRec, RecTy *ItemType) {
break;
}
case tgtok::l_square: {
- TGLoc SquareLoc = Lex.getLoc();
+ SMLoc SquareLoc = Lex.getLoc();
Lex.Lex(); // eat the '['
std::vector<unsigned> Ranges = ParseRangeList();
if (Ranges.empty()) return 0;
@@ -1449,7 +1449,7 @@ std::string TGParser::ParseDeclaration(Record *CurRec,
return "";
}
- TGLoc IdLoc = Lex.getLoc();
+ SMLoc IdLoc = Lex.getLoc();
std::string DeclName = Lex.getCurStrVal();
Lex.Lex();
@@ -1470,7 +1470,7 @@ std::string TGParser::ParseDeclaration(Record *CurRec,
// If a value is present, parse it.
if (Lex.getCode() == tgtok::equal) {
Lex.Lex();
- TGLoc ValLoc = Lex.getLoc();
+ SMLoc ValLoc = Lex.getLoc();
Init *Val = ParseValue(CurRec, Type);
if (Val == 0 ||
SetValue(CurRec, ValLoc, DeclName, std::vector<unsigned>(), Val))
@@ -1536,7 +1536,7 @@ bool TGParser::ParseBodyItem(Record *CurRec) {
if (Lex.Lex() != tgtok::Id)
return TokError("expected field identifier after let");
- TGLoc IdLoc = Lex.getLoc();
+ SMLoc IdLoc = Lex.getLoc();
std::string FieldName = Lex.getCurStrVal();
Lex.Lex(); // eat the field name.
@@ -1640,7 +1640,7 @@ bool TGParser::ParseObjectBody(Record *CurRec) {
/// DefInst ::= DEF ObjectName ObjectBody
///
llvm::Record *TGParser::ParseDef(MultiClass *CurMultiClass) {
- TGLoc DefLoc = Lex.getLoc();
+ SMLoc DefLoc = Lex.getLoc();
assert(Lex.getCode() == tgtok::Def && "Unknown tok");
Lex.Lex(); // Eat the 'def' token.
@@ -1728,7 +1728,7 @@ std::vector<LetRecord> TGParser::ParseLetList() {
return std::vector<LetRecord>();
}
std::string Name = Lex.getCurStrVal();
- TGLoc NameLoc = Lex.getLoc();
+ SMLoc NameLoc = Lex.getLoc();
Lex.Lex(); // Eat the identifier.
// Check for an optional RangeList.
@@ -1780,7 +1780,7 @@ bool TGParser::ParseTopLevelLet() {
if (ParseObject())
return true;
} else { // Object ::= LETCommand '{' ObjectList '}'
- TGLoc BraceLoc = Lex.getLoc();
+ SMLoc BraceLoc = Lex.getLoc();
// Otherwise, this is a group let.
Lex.Lex(); // eat the '{'.
@@ -1905,7 +1905,7 @@ bool TGParser::ParseDefm() {
if (Lex.Lex() != tgtok::Id) // eat the defm.
return TokError("expected identifier after defm");
- TGLoc DefmPrefixLoc = Lex.getLoc();
+ SMLoc DefmPrefixLoc = Lex.getLoc();
std::string DefmPrefix = Lex.getCurStrVal();
if (Lex.Lex() != tgtok::colon)
return TokError("expected ':' after defm identifier");
@@ -1913,7 +1913,7 @@ bool TGParser::ParseDefm() {
// eat the colon.
Lex.Lex();
- TGLoc SubClassLoc = Lex.getLoc();
+ SMLoc SubClassLoc = Lex.getLoc();
SubClassReference Ref = ParseSubClassReference(0, true);
while (1) {
diff --git a/utils/TableGen/TGParser.h b/utils/TableGen/TGParser.h
index c618708ee97..8602357418e 100644
--- a/utils/TableGen/TGParser.h
+++ b/utils/TableGen/TGParser.h
@@ -31,9 +31,9 @@ namespace llvm {
std::string Name;
std::vector<unsigned> Bits;
Init *Value;
- TGLoc Loc;
+ SMLoc Loc;
LetRecord(const std::string &N, const std::vector<unsigned> &B, Init *V,
- TGLoc L)
+ SMLoc L)
: Name(N), Bits(B), Value(V), Loc(L) {
}
};
@@ -55,7 +55,7 @@ public:
/// routines return true on error, or false on success.
bool ParseFile();
- bool Error(TGLoc L, const std::string &Msg) const {
+ bool Error(SMLoc L, const std::string &Msg) const {
Lex.PrintError(L, Msg);
return true;
}
@@ -63,8 +63,8 @@ public:
return Error(Lex.getLoc(), Msg);
}
private: // Semantic analysis methods.
- bool AddValue(Record *TheRec, TGLoc Loc, const RecordVal &RV);
- bool SetValue(Record *TheRec, TGLoc Loc, const std::string &ValName,
+ bool AddValue(Record *TheRec, SMLoc Loc, const RecordVal &RV);
+ bool SetValue(Record *TheRec, SMLoc Loc, const std::string &ValName,
const std::vector<unsigned> &BitList, Init *V);
bool AddSubClass(Record *Rec, SubClassReference &SubClass);
bool AddSubMultiClass(MultiClass *CurMC,
@@ -92,7 +92,7 @@ private: // Parser methods.
SubMultiClassReference ParseSubMultiClassReference(MultiClass *CurMC);
Init *ParseIDValue(Record *CurRec);
- Init *ParseIDValue(Record *CurRec, const std::string &Name, TGLoc NameLoc);
+ Init *ParseIDValue(Record *CurRec, const std::string &Name, SMLoc NameLoc);
Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = 0);
Init *ParseValue(Record *CurRec, RecTy *ItemType = 0);
std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec = 0, RecTy *EltTy = 0);
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp
index dbc4d33e816..a1b768ee7be 100644
--- a/utils/TableGen/TableGen.cpp
+++ b/utils/TableGen/TableGen.cpp
@@ -126,7 +126,7 @@ RecordKeeper llvm::Records;
static TGSourceMgr SrcMgr;
-void llvm::PrintError(TGLoc ErrorLoc, const std::string &Msg) {
+void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) {
SrcMgr.PrintError(ErrorLoc, Msg);
}
@@ -145,7 +145,7 @@ static bool ParseFile(const std::string &Filename,
}
// Tell SrcMgr about this buffer, which is what TGParser will pick up.
- SrcMgr.AddNewSourceBuffer(F, TGLoc());
+ SrcMgr.AddNewSourceBuffer(F, SMLoc());
TGParser Parser(SrcMgr);