[PATCH] Replace std::auto_ptr with std::unique_ptr in IR unittests

Xan López xan at igalia.com
Tue Apr 21 03:32:22 PDT 2015


std::auto_ptr is deprecated in GCC 5.x, so this will not compile out
of the box. We also seem to be using std::unique_ptr all over the
place anyway.

The unit test seems to run just fine after the change.
-------------- next part --------------
>From 4720414af25d1406bcc7e0b16edc5350fd7a234e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Xan=20L=C3=B3pez?= <xan at igalia.com>
Date: Tue, 21 Apr 2015 12:18:47 +0200
Subject: [PATCH] Replace std::auto_ptr with std::unique_ptr

std::auto_ptr is deprecated in GCC 5.0, and we are already using std::unique_ptr all over the place.
---
 unittests/IR/ValueHandleTest.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/unittests/IR/ValueHandleTest.cpp b/unittests/IR/ValueHandleTest.cpp
index 6000c4a..3a93711 100644
--- a/unittests/IR/ValueHandleTest.cpp
+++ b/unittests/IR/ValueHandleTest.cpp
@@ -12,7 +12,6 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
 #include "gtest/gtest.h"
-#include <memory>
 
 using namespace llvm;
 
@@ -21,7 +20,7 @@ namespace {
 class ValueHandle : public testing::Test {
 protected:
   Constant *ConstantV;
-  std::auto_ptr<BitCastInst> BitcastV;
+  std::unique_ptr<BitCastInst> BitcastV;
 
   ValueHandle() :
     ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)),
@@ -320,7 +319,7 @@ TEST_F(ValueHandle, CallbackVH_DeletionCanRAUW) {
   // a CallbackVH to remove the uses before the check for no uses.
   RecoveringVH RVH;
   RVH = BitcastV.get();
-  std::auto_ptr<BinaryOperator> BitcastUser(
+  std::unique_ptr<BinaryOperator> BitcastUser(
     BinaryOperator::CreateAdd(RVH, 
                               Constant::getNullValue(Type::getInt32Ty(getGlobalContext()))));
   EXPECT_EQ(BitcastV.get(), BitcastUser->getOperand(0));
-- 
2.3.5



More information about the llvm-commits mailing list