properly encapsulate the parent field of MBB and MI with get/set accessors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45469 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index eacf067..d2b1d5f 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -33,17 +33,17 @@
 public:
   ilist_traits<MachineInstr>() : parent(0) { }
 
-  static MachineInstr* getPrev(MachineInstr* N) { return N->prev; }
-  static MachineInstr* getNext(MachineInstr* N) { return N->next; }
+  static MachineInstr* getPrev(MachineInstr* N) { return N->Prev; }
+  static MachineInstr* getNext(MachineInstr* N) { return N->Next; }
 
   static const MachineInstr*
-  getPrev(const MachineInstr* N) { return N->prev; }
+  getPrev(const MachineInstr* N) { return N->Prev; }
 
   static const MachineInstr*
-  getNext(const MachineInstr* N) { return N->next; }
+  getNext(const MachineInstr* N) { return N->Next; }
 
-  static void setPrev(MachineInstr* N, MachineInstr* prev) { N->prev = prev; }
-  static void setNext(MachineInstr* N, MachineInstr* next) { N->next = next; }
+  static void setPrev(MachineInstr* N, MachineInstr* prev) { N->Prev = prev; }
+  static void setNext(MachineInstr* N, MachineInstr* next) { N->Next = next; }
 
   static MachineInstr* createSentinel();
   static void destroySentinel(MachineInstr *MI) { delete MI; }
@@ -63,7 +63,9 @@
   MachineBasicBlock *Prev, *Next;
   const BasicBlock *BB;
   int Number;
-  MachineFunction *Parent;
+  MachineFunction *xParent;
+  
+  void setParent(MachineFunction *P) { xParent = P; }
 
   /// Predecessors/Successors - Keep track of the predecessor / successor
   /// basicblocks.
@@ -79,10 +81,8 @@
   bool IsLandingPad;
 
 public:
-  explicit MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0),
-                                                         BB(bb), Number(-1),
-                                                         Parent(0),
-                                                         IsLandingPad(false) {
+  explicit MachineBasicBlock(const BasicBlock *bb = 0)
+    : Prev(0), Next(0), BB(bb), Number(-1), xParent(0), IsLandingPad(false) {
     Insts.parent = this;
   }
 
@@ -95,8 +95,8 @@
 
   /// getParent - Return the MachineFunction containing this basic block.
   ///
-  const MachineFunction *getParent() const { return Parent; }
-  MachineFunction *getParent() { return Parent; }
+  const MachineFunction *getParent() const { return xParent; }
+  MachineFunction *getParent() { return xParent; }
 
   typedef ilist<MachineInstr>::iterator                       iterator;
   typedef ilist<MachineInstr>::const_iterator           const_iterator;
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index d74440f..fa372f6 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -34,8 +34,8 @@
                                         // are determined at construction time).
 
   std::vector<MachineOperand> Operands; // the operands
-  MachineInstr* prev, *next;            // links for our intrusive list
-  MachineBasicBlock* parent;            // pointer to the owning basic block
+  MachineInstr *Prev, *Next;            // Links for MBB's intrusive list.
+  MachineBasicBlock *Parent;            // Pointer to the owning basic block.
 
   // OperandComplete - Return true if it's illegal to add a new operand
   bool OperandsComplete() const;
@@ -45,7 +45,7 @@
 
   // Intrusive list support
   friend struct ilist_traits<MachineInstr>;
-
+  void setParent(MachineBasicBlock *P) { Parent = P; }
 public:
   /// MachineInstr ctor - This constructor creates a dummy MachineInstr with
   /// TID NULL and no operands.
@@ -64,8 +64,8 @@
 
   ~MachineInstr();
 
-  const MachineBasicBlock* getParent() const { return parent; }
-  MachineBasicBlock* getParent() { return parent; }
+  const MachineBasicBlock* getParent() const { return Parent; }
+  MachineBasicBlock* getParent() { return Parent; }
   
   /// getInstrDescriptor - Returns the target instruction descriptor of this
   /// MachineInstr.