diff options
author | Tanya Lattner <tonic@nondot.org> | 2004-05-24 03:14:18 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2004-05-24 03:14:18 +0000 |
commit | 0c63e03e04d3982e1913479bba404c3debc9a27e (patch) | |
tree | a9105aa31e8b4d7edfa54103945ab15a980a47c7 | |
parent | 86f238230bd91dac64a0c2ae62bd2d903777fb5b (diff) | |
download | external_llvm-0c63e03e04d3982e1913479bba404c3debc9a27e.zip external_llvm-0c63e03e04d3982e1913479bba404c3debc9a27e.tar.gz external_llvm-0c63e03e04d3982e1913479bba404c3debc9a27e.tar.bz2 |
Changed clone to be const.
Changed copy constructor to set parent, prev, and next pointers to null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13706 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 2 | ||||
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index a488b45..02c881d 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -460,7 +460,7 @@ public: /// clone - Create a copy of 'this' instruction that is identical in /// all ways except the the instruction has no parent, prev, or next. - MachineInstr* clone(); + MachineInstr* clone() const; // // Debugging support diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 401cd8b..8d2cc93 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -78,6 +78,12 @@ MachineInstr::MachineInstr(const MachineInstr &MI) { //Add operands for(unsigned i=0; i < MI.getNumOperands(); ++i) operands.push_back(MachineOperand(MI.getOperand(i))); + + //Set parent, next, and prev to null + parent = 0; + prev = 0; + next = 0; + } @@ -89,7 +95,7 @@ MachineInstr::~MachineInstr() ///clone - Create a copy of 'this' instruction that is identical in ///all ways except the following: The instruction has no parent The ///instruction has no name -MachineInstr* MachineInstr::clone() { +MachineInstr* MachineInstr::clone() const { return new MachineInstr(*this); } |