[IR] Manage TheNoneToken with a std::unique_ptr
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 16 Nov 2015 20:55:57 +0000 (20:55 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 16 Nov 2015 20:55:57 +0000 (20:55 +0000)
Hopefully, this will make the sanitizer build bots happy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253248 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Constants.cpp
lib/IR/LLVMContextImpl.cpp
lib/IR/LLVMContextImpl.h

index bcca8a2047ff7ef721ddd2543692a671f4fd3908..457b69d2f396f227ff8f185eb5e650c3feb0a7b0 100644 (file)
@@ -1161,8 +1161,8 @@ Constant *ConstantVector::getSplat(unsigned NumElts, Constant *V) {
 ConstantTokenNone *ConstantTokenNone::get(LLVMContext &Context) {
   LLVMContextImpl *pImpl = Context.pImpl;
   if (!pImpl->TheNoneToken)
 ConstantTokenNone *ConstantTokenNone::get(LLVMContext &Context) {
   LLVMContextImpl *pImpl = Context.pImpl;
   if (!pImpl->TheNoneToken)
-    pImpl->TheNoneToken = new ConstantTokenNone(Context);
-  return pImpl->TheNoneToken;
+    pImpl->TheNoneToken.reset(new ConstantTokenNone(Context));
+  return pImpl->TheNoneToken.get();
 }
 
 /// Remove the constant from the constant table.
 }
 
 /// Remove the constant from the constant table.
index 48df5ba62f049f6b8d21aea42e9d33fb20bba8e5..5239b4f7d84a6099b7a445f44f9963c1005c1fc9 100644 (file)
@@ -21,7 +21,6 @@ using namespace llvm;
 
 LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
   : TheTrueVal(nullptr), TheFalseVal(nullptr),
 
 LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
   : TheTrueVal(nullptr), TheFalseVal(nullptr),
-    TheNoneToken(nullptr),
     VoidTy(C, Type::VoidTyID),
     LabelTy(C, Type::LabelTyID),
     HalfTy(C, Type::HalfTyID),
     VoidTy(C, Type::VoidTyID),
     LabelTy(C, Type::LabelTyID),
     HalfTy(C, Type::HalfTyID),
index 3403cd4acfbb7a35bc7630689e6437b7cc249678..7e89b582cbdd91b83488d4406b1a2795ba336679 100644 (file)
@@ -924,7 +924,7 @@ public:
   ConstantInt *TheTrueVal;
   ConstantInt *TheFalseVal;
 
   ConstantInt *TheTrueVal;
   ConstantInt *TheFalseVal;
 
-  ConstantTokenNone *TheNoneToken;
+  std::unique_ptr<ConstantTokenNone> TheNoneToken;
 
   // Basic type instances.
   Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy, TokenTy;
 
   // Basic type instances.
   Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy, TokenTy;