[llvm-commits] CVS: llvm/include/llvm/iMemory.h

Chris Lattner lattner at cs.uiuc.edu
Fri Sep 13 17:29:00 PDT 2002


Changes in directory llvm/include/llvm:

iMemory.h updated: 1.35 -> 1.36

---
Log message:

Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.



---
Diffs of the changes:

Index: llvm/include/llvm/iMemory.h
diff -u llvm/include/llvm/iMemory.h:1.35 llvm/include/llvm/iMemory.h:1.36
--- llvm/include/llvm/iMemory.h:1.35	Tue Sep 10 10:36:09 2002
+++ llvm/include/llvm/iMemory.h	Fri Sep 13 17:28:50 2002
@@ -63,13 +63,15 @@
 //                                MallocInst Class
 //===----------------------------------------------------------------------===//
 
-struct MallocInst : public AllocationInst {
+class MallocInst : public AllocationInst {
+  MallocInst(const MallocInst &MI);
+public:
   MallocInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "",
              Instruction *InsertBefore = 0)
     : AllocationInst(Ty, ArraySize, Malloc, Name, InsertBefore) {}
 
   virtual Instruction *clone() const { 
-    return new MallocInst((Type*)getType(), (Value*)Operands[0].get());
+    return new MallocInst(*this);
   }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -87,13 +89,15 @@
 //                                AllocaInst Class
 //===----------------------------------------------------------------------===//
 
-struct AllocaInst : public AllocationInst {
+class AllocaInst : public AllocationInst {
+  AllocaInst(const AllocaInst &);
+public:
   AllocaInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "",
              Instruction *InsertBefore = 0)
     : AllocationInst(Ty, ArraySize, Alloca, Name, InsertBefore) {}
 
   virtual Instruction *clone() const { 
-    return new AllocaInst((Type*)getType(), (Value*)Operands[0].get());
+    return new AllocaInst(*this);
   }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:





More information about the llvm-commits mailing list