summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/IR/Constants.cpp4
-rw-r--r--llvm/lib/IR/LLVMContextImpl.cpp1
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h2
3 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index bcca8a2047f..457b69d2f39 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -1161,8 +1161,8 @@ Constant *ConstantVector::getSplat(unsigned NumElts, Constant *V) {
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.
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 48df5ba62f0..5239b4f7d84 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -21,7 +21,6 @@ using namespace llvm;
LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
: TheTrueVal(nullptr), TheFalseVal(nullptr),
- TheNoneToken(nullptr),
VoidTy(C, Type::VoidTyID),
LabelTy(C, Type::LabelTyID),
HalfTy(C, Type::HalfTyID),
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 3403cd4acfb..7e89b582cbd 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -924,7 +924,7 @@ public:
ConstantInt *TheTrueVal;
ConstantInt *TheFalseVal;
- ConstantTokenNone *TheNoneToken;
+ std::unique_ptr<ConstantTokenNone> TheNoneToken;
// Basic type instances.
Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy, TokenTy;
OpenPOWER on IntegriCloud