[LLVMdev] A minor improvement: dyn_cast + iterators

Chris Lattner sabre at nondot.org
Wed Apr 23 11:57:01 PDT 2003


This is just a quick note the let everyone know dyn_cast now works
properly with BasicBlock::iterator's and others.  In other words, you can
now do things like this:

for (BasicBlock::iterator I = BB.begin();
     PHINode *PN = dyn_cast<PHINode>(I); ++I)
   ...

instead of this:

for (BasicBlock::iterator I = BB.begin();
     PHINode *PN = dyn_cast<PHINode>(&*I); ++I)
   ...

This was a long standing problem that I finally got around to fixing.  Now
you should almost never need to use "&*" anymore.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list