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

pointer type returned.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3711 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-09-13 22:28:50 +00:00
parent 05804b7459
commit e87e1c9aa9
5 changed files with 33 additions and 13 deletions

View File

@@ -63,13 +63,15 @@ public:
// 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 @@ struct MallocInst : public AllocationInst {
// 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: