From f85d5cfbf6e0c013af62268973b23af2ea073d92 Mon Sep 17 00:00:00 2001 From: Anton Yartsev Date: Thu, 25 Sep 2014 19:55:58 +0000 Subject: [PATCH] Refactoring: raw pointer -> unique_ptr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218462 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/TableGen/TGParser.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp index f2910019ed9..2e67f5fa977 100644 --- a/lib/TableGen/TGParser.cpp +++ b/lib/TableGen/TGParser.cpp @@ -232,16 +232,14 @@ bool TGParser::AddSubMultiClass(MultiClass *CurMC, i != iend; ++i) { // Clone the def and add it to the current multiclass - Record *NewDef = new Record(**i); + auto NewDef = make_unique(**i); // Add all of the values in the superclass into the current def. for (unsigned i = 0, e = MCVals.size(); i != e; ++i) - if (AddValue(NewDef, SubMultiClass.RefRange.Start, MCVals[i])) { - delete NewDef; + if (AddValue(NewDef.get(), SubMultiClass.RefRange.Start, MCVals[i])) return true; - } - CurMC->DefPrototypes.push_back(NewDef); + CurMC->DefPrototypes.push_back(NewDef.release()); } const std::vector &SMCTArgs = SMC->Rec.getTemplateArgs(); -- 2.34.1