[llvm] r235466 - [TableGen] Use StringRecTy::get() instead of allocating (and leaking) a StringRecTy object.

Craig Topper craig.topper at gmail.com
Tue Apr 21 19:09:47 PDT 2015


Author: ctopper
Date: Tue Apr 21 21:09:47 2015
New Revision: 235466

URL: http://llvm.org/viewvc/llvm-project?rev=235466&view=rev
Log:
[TableGen] Use StringRecTy::get() instead of allocating (and leaking) a StringRecTy object.

Modified:
    llvm/trunk/lib/TableGen/Record.cpp

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=235466&r1=235465&r2=235466&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Tue Apr 21 21:09:47 2015
@@ -253,7 +253,7 @@ Init *StringRecTy::convertValue(UnOpInit
     Init *L = BO->getOperand()->convertInitializerTo(this);
     if (!L) return nullptr;
     if (L != BO->getOperand())
-      return UnOpInit::get(UnOpInit::CAST, L, new StringRecTy);
+      return UnOpInit::get(UnOpInit::CAST, L, StringRecTy::get());
     return BO;
   }
 
@@ -266,7 +266,7 @@ Init *StringRecTy::convertValue(BinOpIni
     Init *R = BO->getRHS()->convertInitializerTo(this);
     if (!L || !R) return nullptr;
     if (L != BO->getLHS() || R != BO->getRHS())
-      return BinOpInit::get(BinOpInit::STRCONCAT, L, R, new StringRecTy);
+      return BinOpInit::get(BinOpInit::STRCONCAT, L, R, StringRecTy::get());
     return BO;
   }
 





More information about the llvm-commits mailing list