summaryrefslogtreecommitdiff
path: root/docs/ProgrammersManual.html
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-22 04:49:59 +0000
committerChris Lattner <sabre@nondot.org>2005-04-22 04:49:59 +0000
commit53f72b3bab0e8b474f6ded9ee46957fd89d01cda (patch)
treedca142f69a31e506886a69b4d5d7ab9fc3cb326f /docs/ProgrammersManual.html
parentea3e5e56fdc56e5c2ddafb36eab26676e137dfa0 (diff)
downloadllvm-53f72b3bab0e8b474f6ded9ee46957fd89d01cda.tar.gz
llvm-53f72b3bab0e8b474f6ded9ee46957fd89d01cda.tar.bz2
llvm-53f72b3bab0e8b474f6ded9ee46957fd89d01cda.tar.xz
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
Diffstat (limited to 'docs/ProgrammersManual.html')
-rw-r--r--docs/ProgrammersManual.html16
1 files changed, 4 insertions, 12 deletions
diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html
index 0af3a9dac2..eb3bde98a8 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).</p>
if (isa&lt;<a href="#Constant">Constant</a>&gt;(V) || isa&lt;<a href="#Argument">Argument</a>&gt;(V) || isa&lt;<a href="#GlobalValue">GlobalValue</a>&gt;(V))
return true;
- <i>// Otherwise, it must be an instruction...</i>
- return !L-&gt;contains(cast&lt;<a href="#Instruction">Instruction</a>&gt;(V)-&gt;getParent());
+ <i>// Otherwise, it must be an instruction...</i>
+ return !L-&gt;contains(cast&lt;<a href="#Instruction">Instruction</a>&gt;(V)-&gt;getParent());
+ }
</pre>
<p>Note that you should <b>not</b> use an <tt>isa&lt;&gt;</tt> test followed
@@ -322,21 +323,12 @@ file (note that you very rarely have to include this file directly).</p>
call to <tt>isa&lt;&gt;</tt> and a call to <tt>cast&lt;&gt;</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-&gt;begin();
- for (; <a href="#PhiNode">PHINode</a> *PN = dyn_cast&lt;<a href="#PHINode">PHINode</a>&gt;(BBI); ++BBI)
- std::cerr &lt;&lt; *PN;
- </pre>
-
<p>Note that the <tt>dyn_cast&lt;&gt;</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>