summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2004-05-24 03:14:18 +0000
committerTanya Lattner <tonic@nondot.org>2004-05-24 03:14:18 +0000
commitbcee21b4912ae793b9e61c03872cceafed846d1d (patch)
treedb70f23aa1982a9f3e139e0de249cdd06e64d010
parent4da526425396e1f6ea2d0c1bf10d2d25c4f2fca2 (diff)
downloadbcm5719-llvm-bcee21b4912ae793b9e61c03872cceafed846d1d.tar.gz
bcm5719-llvm-bcee21b4912ae793b9e61c03872cceafed846d1d.zip
Changed clone to be const.
Changed copy constructor to set parent, prev, and next pointers to null. llvm-svn: 13706
-rw-r--r--llvm/include/llvm/CodeGen/MachineInstr.h2
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp8
2 files changed, 8 insertions, 2 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index a488b45f781..02c881d64a9 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/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/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 401cd8b4172..8d2cc932b2e 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud