[llvm] r210606 - Use unique_ptr for X86Subtarget pointer members.
Eric Christopher
echristo at gmail.com
Tue Jun 10 16:26:47 PDT 2014
Author: echristo
Date: Tue Jun 10 18:26:47 2014
New Revision: 210606
URL: http://llvm.org/viewvc/llvm-project?rev=210606&view=rev
Log:
Use unique_ptr for X86Subtarget pointer members.
Modified:
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
llvm/trunk/lib/Target/X86/X86Subtarget.h
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=210606&r1=210605&r2=210606&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Jun 10 18:26:47 2014
@@ -351,19 +351,12 @@ X86Subtarget::X86Subtarget(const std::st
resetSubtargetFeatures(CPU, FS);
// Ordering here is important. X86InstrInfo initializes X86RegisterInfo which
// X86TargetLowering needs.
- InstrInfo = new X86InstrInfo(*this);
- TLInfo = new X86TargetLowering(TM);
- FrameLowering = new X86FrameLowering(TargetFrameLowering::StackGrowsDown,
- getStackAlignment(),
- is64Bit() ? -8 : -4);
- JITInfo = new X86JITInfo(hasSSE1());
-}
-
-X86Subtarget::~X86Subtarget() {
- delete TLInfo;
- delete InstrInfo;
- delete FrameLowering;
- delete JITInfo;
+ InstrInfo = make_unique<X86InstrInfo>(*this);
+ TLInfo = make_unique<X86TargetLowering>(TM);
+ FrameLowering =
+ make_unique<X86FrameLowering>(TargetFrameLowering::StackGrowsDown,
+ getStackAlignment(), is64Bit() ? -8 : -4);
+ JITInfo = make_unique<X86JITInfo>(hasSSE1());
}
bool
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=210606&r1=210605&r2=210606&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Jun 10 18:26:47 2014
@@ -229,10 +229,10 @@ private:
// Calculates type size & alignment
const DataLayout DL;
X86SelectionDAGInfo TSInfo;
- X86TargetLowering *TLInfo;
- X86InstrInfo *InstrInfo;
- X86FrameLowering *FrameLowering;
- X86JITInfo *JITInfo;
+ std::unique_ptr<X86TargetLowering> TLInfo;
+ std::unique_ptr<X86InstrInfo> InstrInfo;
+ std::unique_ptr<X86FrameLowering> FrameLowering;
+ std::unique_ptr<X86JITInfo> JITInfo;
public:
/// This constructor initializes the data members to match that
@@ -241,14 +241,15 @@ public:
X86Subtarget(const std::string &TT, const std::string &CPU,
const std::string &FS, X86TargetMachine &TM,
unsigned StackAlignOverride);
- ~X86Subtarget();
- const X86TargetLowering *getTargetLowering() const { return TLInfo; }
- const X86InstrInfo *getInstrInfo() const { return InstrInfo; }
+ const X86TargetLowering *getTargetLowering() const { return TLInfo.get(); }
+ const X86InstrInfo *getInstrInfo() const { return InstrInfo.get(); }
const DataLayout *getDataLayout() const { return &DL; }
- const X86FrameLowering *getFrameLowering() const { return FrameLowering; }
+ const X86FrameLowering *getFrameLowering() const {
+ return FrameLowering.get();
+ }
const X86SelectionDAGInfo *getSelectionDAGInfo() const { return &TSInfo; }
- X86JITInfo *getJITInfo() { return JITInfo; }
+ X86JITInfo *getJITInfo() { return JITInfo.get(); }
/// getStackAlignment - Returns the minimum alignment known to hold of the
/// stack frame on entry to the function and which must be maintained by every
More information about the llvm-commits
mailing list