[llvm-commits] CVS: llvm/docs/ProgrammersManual.html
Chris Lattner
lattner at cs.uiuc.edu
Thu Apr 21 21:50:15 PDT 2005
Changes in directory llvm/docs:
ProgrammersManual.html updated: 1.79 -> 1.80
---
Log message:
remove 'another common example', which doesn't work with VC++, and indent
another example properly
---
Diffs of the changes: (+5 -13)
ProgrammersManual.html | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.79 llvm/docs/ProgrammersManual.html:1.80
--- llvm/docs/ProgrammersManual.html:1.79 Mon Mar 14 23:19:20 2005
+++ llvm/docs/ProgrammersManual.html Thu Apr 21 23:49:59 2005
@@ -292,8 +292,9 @@
if (isa<<a href="#Constant">Constant</a>>(V) || isa<<a href="#Argument">Argument</a>>(V) || isa<<a href="#GlobalValue">GlobalValue</a>>(V))
return true;
- <i>// Otherwise, it must be an instruction...</i>
- return !L->contains(cast<<a href="#Instruction">Instruction</a>>(V)->getParent());
+ <i>// Otherwise, it must be an instruction...</i>
+ return !L->contains(cast<<a href="#Instruction">Instruction</a>>(V)->getParent());
+ }
</pre>
<p>Note that you should <b>not</b> use an <tt>isa<></tt> test followed
@@ -322,21 +323,12 @@
call to <tt>isa<></tt> and a call to <tt>cast<></tt> into one
statement, which is very convenient.</p>
- <p> Another common example is:</p>
-
- <pre>
- <i>// Loop over all of the phi nodes in a basic block</i>
- BasicBlock::iterator BBI = BB->begin();
- for (; <a href="#PhiNode">PHINode</a> *PN = dyn_cast<<a href="#PHINode">PHINode</a>>(BBI); ++BBI)
- std::cerr << *PN;
- </pre>
-
<p>Note that the <tt>dyn_cast<></tt> operator, like C++'s
<tt>dynamic_cast</tt> or Java's <tt>instanceof</tt> operator, can be abused.
In particular you should not use big chained <tt>if/then/else</tt> 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.</p>
+ <tt>InstVisitor</tt> class to dispatch over the instruction type directly.</p>
</dd>
@@ -2049,7 +2041,7 @@
<a href="mailto:dhurjati at cs.uiuc.edu">Dinakar Dhurjati</a> and
<a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2005/03/15 05:19:20 $
+ Last modified: $Date: 2005/04/22 04:49:59 $
</address>
</body>
More information about the llvm-commits
mailing list