diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 0af3a9dac2e..eb3bde98a8b 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -292,8 +292,9 @@ file (note that you very rarely have to include this file directly).
if (isa<Constant>(V) || isa<Argument>(V) || isa<GlobalValue>(V)) return true; - // Otherwise, it must be an instruction... - return !L->contains(cast<Instruction>(V)->getParent()); + // Otherwise, it must be an instruction... + return !L->contains(cast<Instruction>(V)->getParent()); + }Note that you should not use an isa<> test followed @@ -322,21 +323,12 @@ file (note that you very rarely have to include this file directly).
call to isa<> and a call to cast<> into one statement, which is very convenient. -Another common example is:
- -- // Loop over all of the phi nodes in a basic block - BasicBlock::iterator BBI = BB->begin(); - for (; PHINode *PN = dyn_cast<PHINode>(BBI); ++BBI) - std::cerr << *PN; --
Note that the dyn_cast<> operator, like C++'s dynamic_cast or Java's instanceof operator, can be abused. In particular you should not use big chained if/then/else blocks to check for lots of different variants of classes. If you find yourself wanting to do this, it is much cleaner and more efficient to use the - InstVisitor class to dispatch over the instruction type directly.
+ InstVisitor class to dispatch over the instruction type directly.