From: Chris Lattner
Date: Fri, 22 Apr 2005 04:49:59 +0000 (+0000)
Subject: remove 'another common example', which doesn't work with VC++, and indent
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=53f72b3bab0e8b474f6ded9ee46957fd89d01cda;p=oota-llvm.git
remove 'another common example', which doesn't work with VC++, and indent
another example properly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21442 91177308-0d34-0410-b5e6-96231b3b80d8
---
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.