[C++11] Replace OwningPtr with std::unique_ptr in places where it doesn't break the API.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206740 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2014-04-21 09:34:48 +00:00
parent 4d3682bda5
commit 1d16fdecd6
12 changed files with 23 additions and 32 deletions

View File

@ -17,8 +17,8 @@
#define LLVM_ADT_EDIT_DISTANCE_H #define LLVM_ADT_EDIT_DISTANCE_H
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/OwningPtr.h"
#include <algorithm> #include <algorithm>
#include <memory>
namespace llvm { namespace llvm {
@ -57,7 +57,7 @@ unsigned ComputeEditDistance(ArrayRef<T> FromArray, ArrayRef<T> ToArray,
const unsigned SmallBufferSize = 64; const unsigned SmallBufferSize = 64;
unsigned SmallBuffer[SmallBufferSize]; unsigned SmallBuffer[SmallBufferSize];
llvm::OwningArrayPtr<unsigned> Allocated; std::unique_ptr<unsigned[]> Allocated;
unsigned *Previous = SmallBuffer; unsigned *Previous = SmallBuffer;
if (2*(n + 1) > SmallBufferSize) { if (2*(n + 1) > SmallBufferSize) {
Previous = new unsigned [2*(n+1)]; Previous = new unsigned [2*(n+1)];

View File

@ -25,7 +25,6 @@
#define LLVM_CODEGEN_LIVEREGMATRIX_H #define LLVM_CODEGEN_LIVEREGMATRIX_H
#include "llvm/ADT/BitVector.h" #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/CodeGen/LiveIntervalUnion.h" #include "llvm/CodeGen/LiveIntervalUnion.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
@ -51,7 +50,7 @@ class LiveRegMatrix : public MachineFunctionPass {
LiveIntervalUnion::Array Matrix; LiveIntervalUnion::Array Matrix;
// Cached queries per register unit. // Cached queries per register unit.
OwningArrayPtr<LiveIntervalUnion::Query> Queries; std::unique_ptr<LiveIntervalUnion::Query[]> Queries;
// Cached register mask interference info. // Cached register mask interference info.
unsigned RegMaskTag; unsigned RegMaskTag;

View File

@ -19,7 +19,6 @@
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h" #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetRegisterInfo.h"
namespace llvm { namespace llvm {
@ -31,7 +30,7 @@ class RegisterClassInfo {
bool ProperSubClass; bool ProperSubClass;
uint8_t MinCost; uint8_t MinCost;
uint16_t LastCostChange; uint16_t LastCostChange;
OwningArrayPtr<MCPhysReg> Order; std::unique_ptr<MCPhysReg[]> Order;
RCInfo() RCInfo()
: Tag(0), NumRegs(0), ProperSubClass(false), MinCost(0), : Tag(0), NumRegs(0), ProperSubClass(false), MinCost(0),
@ -43,7 +42,7 @@ class RegisterClassInfo {
}; };
// Brief cached information for each register class. // Brief cached information for each register class.
OwningArrayPtr<RCInfo> RegClass; std::unique_ptr<RCInfo[]> RegClass;
// Tag changes whenever cached information needs to be recomputed. An RCInfo // Tag changes whenever cached information needs to be recomputed. An RCInfo
// entry is valid when its tag matches. // entry is valid when its tag matches.
@ -62,7 +61,7 @@ class RegisterClassInfo {
// Reserved registers in the current MF. // Reserved registers in the current MF.
BitVector Reserved; BitVector Reserved;
OwningArrayPtr<unsigned> PSetLimits; std::unique_ptr<unsigned[]> PSetLimits;
// Compute all information about RC. // Compute all information about RC.
void compute(const TargetRegisterClass *RC) const; void compute(const TargetRegisterClass *RC) const;

View File

@ -11,9 +11,9 @@
#define LLVM_LINEEDITOR_LINEEDITOR_H #define LLVM_LINEEDITOR_LINEEDITOR_H
#include "llvm/ADT/Optional.h" #include "llvm/ADT/Optional.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include <stdio.h> #include <cstdio>
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -10,7 +10,6 @@
#define LLVM_MC_MCDISASSEMBLER_H #define LLVM_MC_MCDISASSEMBLER_H
#include "llvm-c/Disassembler.h" #include "llvm-c/Disassembler.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/MC/MCRelocationInfo.h" #include "llvm/MC/MCRelocationInfo.h"
#include "llvm/MC/MCSymbolizer.h" #include "llvm/MC/MCSymbolizer.h"
#include "llvm/Support/DataTypes.h" #include "llvm/Support/DataTypes.h"

View File

@ -23,7 +23,6 @@
#include "Thumb1FrameLowering.h" #include "Thumb1FrameLowering.h"
#include "Thumb1InstrInfo.h" #include "Thumb1InstrInfo.h"
#include "Thumb2InstrInfo.h" #include "Thumb2InstrInfo.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
@ -128,12 +127,12 @@ public:
class ThumbTargetMachine : public ARMBaseTargetMachine { class ThumbTargetMachine : public ARMBaseTargetMachine {
virtual void anchor(); virtual void anchor();
// Either Thumb1InstrInfo or Thumb2InstrInfo. // Either Thumb1InstrInfo or Thumb2InstrInfo.
OwningPtr<ARMBaseInstrInfo> InstrInfo; std::unique_ptr<ARMBaseInstrInfo> InstrInfo;
const DataLayout DL; // Calculates type size & alignment const DataLayout DL; // Calculates type size & alignment
ARMTargetLowering TLInfo; ARMTargetLowering TLInfo;
ARMSelectionDAGInfo TSInfo; ARMSelectionDAGInfo TSInfo;
// Either Thumb1FrameLowering or ARMFrameLowering. // Either Thumb1FrameLowering or ARMFrameLowering.
OwningPtr<ARMFrameLowering> FrameLowering; std::unique_ptr<ARMFrameLowering> FrameLowering;
public: public:
ThumbTargetMachine(const Target &T, StringRef TT, ThumbTargetMachine(const Target &T, StringRef TT,
StringRef CPU, StringRef FS, StringRef CPU, StringRef FS,

View File

@ -13,7 +13,6 @@
#include "MCTargetDesc/ARMArchName.h" #include "MCTargetDesc/ARMArchName.h"
#include "MCTargetDesc/ARMBaseInfo.h" #include "MCTargetDesc/ARMBaseInfo.h"
#include "MCTargetDesc/ARMMCExpr.h" #include "MCTargetDesc/ARMMCExpr.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringExtras.h"
@ -2917,7 +2916,7 @@ int ARMAsmParser::tryParseShiftRegister(
// The source register for the shift has already been added to the // The source register for the shift has already been added to the
// operand list, so we need to pop it off and combine it into the shifted // operand list, so we need to pop it off and combine it into the shifted
// register operand instead. // register operand instead.
OwningPtr<ARMOperand> PrevOp((ARMOperand*)Operands.pop_back_val()); std::unique_ptr<ARMOperand> PrevOp((ARMOperand*)Operands.pop_back_val());
if (!PrevOp->isReg()) if (!PrevOp->isReg())
return Error(PrevOp->getStartLoc(), "shift must be of a register"); return Error(PrevOp->getStartLoc(), "shift must be of a register");
int SrcReg = PrevOp->getReg(); int SrcReg = PrevOp->getReg();

View File

@ -14,7 +14,6 @@
#ifndef HEXAGONASMPRINTER_H #ifndef HEXAGONASMPRINTER_H
#define HEXAGONASMPRINTER_H #define HEXAGONASMPRINTER_H
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/PriorityQueue.h" #include "llvm/ADT/PriorityQueue.h"
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h"

View File

@ -610,7 +610,7 @@ bool Filler::searchSuccBBs(MachineBasicBlock &MBB, Iter Slot) const {
RegDefsUses RegDU(TM); RegDefsUses RegDU(TM);
bool HasMultipleSuccs = false; bool HasMultipleSuccs = false;
BB2BrMap BrMap; BB2BrMap BrMap;
OwningPtr<InspectMemInstr> IM; std::unique_ptr<InspectMemInstr> IM;
Iter Filler; Iter Filler;
// Iterate over SuccBB's predecessor list. // Iterate over SuccBB's predecessor list.

View File

@ -20,7 +20,6 @@
#include "MipsJITInfo.h" #include "MipsJITInfo.h"
#include "MipsSelectionDAGInfo.h" #include "MipsSelectionDAGInfo.h"
#include "MipsSubtarget.h" #include "MipsSubtarget.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
@ -34,15 +33,15 @@ class MipsRegisterInfo;
class MipsTargetMachine : public LLVMTargetMachine { class MipsTargetMachine : public LLVMTargetMachine {
MipsSubtarget Subtarget; MipsSubtarget Subtarget;
const DataLayout DL; // Calculates type size & alignment const DataLayout DL; // Calculates type size & alignment
OwningPtr<const MipsInstrInfo> InstrInfo; std::unique_ptr<const MipsInstrInfo> InstrInfo;
OwningPtr<const MipsFrameLowering> FrameLowering; std::unique_ptr<const MipsFrameLowering> FrameLowering;
OwningPtr<const MipsTargetLowering> TLInfo; std::unique_ptr<const MipsTargetLowering> TLInfo;
OwningPtr<const MipsInstrInfo> InstrInfo16; std::unique_ptr<const MipsInstrInfo> InstrInfo16;
OwningPtr<const MipsFrameLowering> FrameLowering16; std::unique_ptr<const MipsFrameLowering> FrameLowering16;
OwningPtr<const MipsTargetLowering> TLInfo16; std::unique_ptr<const MipsTargetLowering> TLInfo16;
OwningPtr<const MipsInstrInfo> InstrInfoSE; std::unique_ptr<const MipsInstrInfo> InstrInfoSE;
OwningPtr<const MipsFrameLowering> FrameLoweringSE; std::unique_ptr<const MipsFrameLowering> FrameLoweringSE;
OwningPtr<const MipsTargetLowering> TLInfoSE; std::unique_ptr<const MipsTargetLowering> TLInfoSE;
MipsSelectionDAGInfo TSInfo; MipsSelectionDAGInfo TSInfo;
const InstrItineraryData &InstrItins; const InstrItineraryData &InstrItins;
MipsJITInfo JITInfo; MipsJITInfo JITInfo;

View File

@ -16,7 +16,6 @@
#include "NVPTX.h" #include "NVPTX.h"
#include "NVPTXAllocaHoisting.h" #include "NVPTXAllocaHoisting.h"
#include "NVPTXLowerAggrCopies.h" #include "NVPTXLowerAggrCopies.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/Passes.h"
#include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineFunctionAnalysis.h" #include "llvm/CodeGen/MachineFunctionAnalysis.h"

View File

@ -20,7 +20,6 @@
#include "AMDGPUSubtarget.h" #include "AMDGPUSubtarget.h"
#include "AMDILIntrinsicInfo.h" #include "AMDILIntrinsicInfo.h"
#include "R600ISelLowering.h" #include "R600ISelLowering.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
namespace llvm { namespace llvm {
@ -31,8 +30,8 @@ class AMDGPUTargetMachine : public LLVMTargetMachine {
const DataLayout Layout; const DataLayout Layout;
AMDGPUFrameLowering FrameLowering; AMDGPUFrameLowering FrameLowering;
AMDGPUIntrinsicInfo IntrinsicInfo; AMDGPUIntrinsicInfo IntrinsicInfo;
OwningPtr<AMDGPUInstrInfo> InstrInfo; std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
OwningPtr<AMDGPUTargetLowering> TLInfo; std::unique_ptr<AMDGPUTargetLowering> TLInfo;
const InstrItineraryData *InstrItins; const InstrItineraryData *InstrItins;
public: public: