summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-06-01 06:56:16 +0000
committerCraig Topper <craig.topper@gmail.com>2017-06-01 06:56:16 +0000
commitf44122608535702f7e45c268921e7dc6a1898021 (patch)
tree978e0fab11a2beb425adaa453fcb1a0fee7eb9dd /llvm/lib
parentc05a1032e9f7cd1bfdd0b76a944ccc0a1018776d (diff)
downloadbcm5719-llvm-f44122608535702f7e45c268921e7dc6a1898021.tar.gz
bcm5719-llvm-f44122608535702f7e45c268921e7dc6a1898021.zip
[TableGen] Remove RecordVal constructor that takes a StringRef and Record::setName(StringRef). Leave just the versions that take an Init.
They weren't used often enough to justify having two different interfaces. Push the responsiblity of creating a StringInit up to the caller. llvm-svn: 304388
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/TableGen/Record.cpp7
-rw-r--r--llvm/lib/TableGen/TGParser.cpp8
-rw-r--r--llvm/lib/TableGen/TGParser.h2
3 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index b7432d5314c..83f7147dc9f 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -1597,8 +1597,7 @@ void Record::init() {
// Every record potentially has a def at the top. This value is
// replaced with the top-level def name at instantiation time.
- RecordVal DN("NAME", StringRecTy::get(), false);
- addValue(DN);
+ addValue(RecordVal(StringInit::get("NAME"), StringRecTy::get(), false));
}
void Record::checkName() {
@@ -1634,10 +1633,6 @@ void Record::setName(Init *NewName) {
// this. See TGParser::ParseDef and TGParser::ParseDefm.
}
-void Record::setName(StringRef Name) {
- setName(StringInit::get(Name));
-}
-
void Record::resolveReferencesTo(const RecordVal *RV) {
for (RecordVal &Value : Values) {
if (RV == &Value) // Skip resolve the same field as the given one
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 96015b06d79..b492cf9495c 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -339,7 +339,7 @@ bool TGParser::ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals){
if (!IVal)
return Error(Loc, "foreach iterator value is untyped");
- IterRec->addValue(RecordVal(IterVar->getName(), IVal->getType(), false));
+ IterRec->addValue(RecordVal(IterVar->getNameInit(), IVal->getType(), false));
if (SetValue(IterRec.get(), Loc, IterVar->getNameInit(), None, IVal))
return Error(Loc, "when instantiating this def");
@@ -378,8 +378,8 @@ static bool isObjectStart(tgtok::TokKind K) {
/// GetNewAnonymousName - Generate a unique anonymous name that can be used as
/// an identifier.
-std::string TGParser::GetNewAnonymousName() {
- return "anonymous_" + utostr(AnonCounter++);
+Init *TGParser::GetNewAnonymousName() {
+ return StringInit::get("anonymous_" + utostr(AnonCounter++));
}
/// ParseObjectName - If an object name is specified, return it. Otherwise,
@@ -2350,7 +2350,7 @@ Record *TGParser::InstantiateMulticlassDef(MultiClass &MC, Record *DefProto,
bool IsAnonymous = false;
if (!DefmPrefix) {
- DefmPrefix = StringInit::get(GetNewAnonymousName());
+ DefmPrefix = GetNewAnonymousName();
IsAnonymous = true;
}
diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h
index 76f7d8fe502..1b2966c9f6c 100644
--- a/llvm/lib/TableGen/TGParser.h
+++ b/llvm/lib/TableGen/TGParser.h
@@ -110,7 +110,7 @@ private: // Semantic analysis methods.
bool AddSubMultiClass(MultiClass *CurMC,
SubMultiClassReference &SubMultiClass);
- std::string GetNewAnonymousName();
+ Init *GetNewAnonymousName();
// IterRecord: Map an iterator name to a value.
struct IterRecord {
OpenPOWER on IntegriCloud