[LLVMdev] Add assert in llvm::StroreInst::init and llvm::LoadInst::init

Chris Lattner sabre at nondot.org
Thu Jul 1 15:29:01 PDT 2004

On Thu, 1 Jul 2004, Vladimir Merzliakov wrote:

> I propose add assert
> assert(Ptr && Ptr->getType()->getTypeID()==llvm::Type::PointerTyID && "Ptr
> must have pointer type.")
> in
> llvm::StroreInst::init and llvm::LoadInst::init functions

Sounds good.  One comment, FYI.  The above can be written to use:
  ... isa<PointerType>(Ptr->getType()) ...

instead of digging in with getTypeID().  This makes the code a bit easier
to read.

> This is requared including llvm/Type.h or moving init function definitions
> to iMemory.cpp.
> I don't known more acceptable variant and then sending as attachment both
> versions: iMemory.patch1 and iMemory.patch2 .

Sounds great!  I've taken the second approach (to avoid including Type.h
into iMemory.h, and applied a slightly modified version of your patch:


Thanks a lot!



More information about the llvm-dev mailing list