[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304388 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2017-06-01 06:56:16 +00:00
parent 9ca534daa4
commit 4b8d5408e9
4 changed files with 6 additions and 14 deletions

View File

@ -1237,8 +1237,6 @@ class RecordVal {
public:
RecordVal(Init *N, RecTy *T, bool P);
RecordVal(StringRef N, RecTy *T, bool P)
: RecordVal(StringInit::get(N), T, P) {}
StringRef getName() const;
Init *getNameInit() const { return Name; }
@ -1341,7 +1339,6 @@ public:
}
void setName(Init *Name); // Also updates RecordKeeper.
void setName(StringRef Name); // Also updates RecordKeeper.
ArrayRef<SMLoc> getLoc() const { return Locs; }

View File

@ -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

View File

@ -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;
}

View File

@ -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 {