diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-11-29 05:52:51 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-11-29 05:52:51 +0000 |
commit | 2935bbc520e87b139f474e9719dc7ea77c76a803 (patch) | |
tree | 968e5eb1e2b4dff097e4648840e60b4e8fce576f /lib | |
parent | 2d370703cd4b00559a0790d9ff484917a8d1ef23 (diff) |
Make RecordKeeper::addClass/addDef take unique_ptrs instead of creating one internally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/TableGen/TGParser.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp index c594da8b350..8f83714d32e 100644 --- a/lib/TableGen/TGParser.cpp +++ b/lib/TableGen/TGParser.cpp @@ -371,7 +371,7 @@ bool TGParser::ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals){ } Record *IterRecSave = IterRec.get(); // Keep a copy before release. - Records.addDef(IterRec.release()); + Records.addDef(std::move(IterRec)); IterRecSave->resolveReferences(); return false; } @@ -1252,7 +1252,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType, if (!CurMultiClass) { NewRec->resolveReferences(); - Records.addDef(NewRecOwner.release()); + Records.addDef(std::move(NewRecOwner)); } else { // This needs to get resolved once the multiclass template arguments are // known before any use. @@ -2044,7 +2044,7 @@ bool TGParser::ParseDef(MultiClass *CurMultiClass) { if (Records.getDef(CurRec->getNameInitAsString())) return Error(DefLoc, "def '" + CurRec->getNameInitAsString()+ "' already defined"); - Records.addDef(CurRecOwner.release()); + Records.addDef(std::move(CurRecOwner)); if (ParseObjectBody(CurRec)) return true; @@ -2169,8 +2169,10 @@ bool TGParser::ParseClass() { + "' already defined"); } else { // If this is the first reference to this class, create and add it. - CurRec = new Record(Lex.getCurStrVal(), Lex.getLoc(), Records); - Records.addClass(CurRec); + auto NewRec = make_unique<Record>(Lex.getCurStrVal(), Lex.getLoc(), + Records); + CurRec = NewRec.get(); + Records.addClass(std::move(NewRec)); } Lex.Lex(); // eat the name. @@ -2442,7 +2444,7 @@ InstantiateMulticlassDef(MultiClass &MC, } Record *CurRecSave = CurRec.get(); // Keep a copy before we release. - Records.addDef(CurRec.release()); + Records.addDef(std::move(CurRec)); return CurRecSave; } |