[llvm] r253248 - [IR] Manage TheNoneToken with a std::unique_ptr
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 16 12:55:57 PST 2015
Author: majnemer
Date: Mon Nov 16 14:55:57 2015
New Revision: 253248
URL: http://llvm.org/viewvc/llvm-project?rev=253248&view=rev
Log:
[IR] Manage TheNoneToken with a std::unique_ptr
Hopefully, this will make the sanitizer build bots happy.
Modified:
llvm/trunk/lib/IR/Constants.cpp
llvm/trunk/lib/IR/LLVMContextImpl.cpp
llvm/trunk/lib/IR/LLVMContextImpl.h
Modified: llvm/trunk/lib/IR/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Constants.cpp?rev=253248&r1=253247&r2=253248&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Constants.cpp (original)
+++ llvm/trunk/lib/IR/Constants.cpp Mon Nov 16 14:55:57 2015
@@ -1161,8 +1161,8 @@ Constant *ConstantVector::getSplat(unsig
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.
Modified: llvm/trunk/lib/IR/LLVMContextImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.cpp?rev=253248&r1=253247&r2=253248&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.cpp Mon Nov 16 14:55:57 2015
@@ -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),
Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=253248&r1=253247&r2=253248&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Mon Nov 16 14:55:57 2015
@@ -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;
More information about the llvm-commits
mailing list