[TableGen] Make one of RecordVal's constructors delegate to the other to reduce duplicate code.

llvm-svn: 304280
This commit is contained in:
Craig Topper 2017-05-31 05:12:33 +00:00
parent 5863087ad3
commit 01197f686f
2 changed files with 2 additions and 7 deletions

View File

@ -1237,7 +1237,8 @@ class RecordVal {
public:
RecordVal(Init *N, RecTy *T, bool P);
RecordVal(StringRef 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; }

View File

@ -1572,12 +1572,6 @@ RecordVal::RecordVal(Init *N, RecTy *T, bool P)
assert(Value && "Cannot create unset value for current type!");
}
RecordVal::RecordVal(StringRef N, RecTy *T, bool P)
: Name(StringInit::get(N)), TyAndPrefix(T, P) {
Value = UnsetInit::get()->convertInitializerTo(T);
assert(Value && "Cannot create unset value for current type!");
}
StringRef RecordVal::getName() const {
return cast<StringInit>(getNameInit())->getValue();
}