summaryrefslogtreecommitdiff
path: root/docs/CodingStandards.html
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-27 04:24:14 +0000
committerChris Lattner <sabre@nondot.org>2006-07-27 04:24:14 +0000
commit6883a88fdbcb386d4d7d8d2714be7bd2e0e29ed9 (patch)
tree9e316c99d93ba4eccdb9e436cdebbdda5c862440 /docs/CodingStandards.html
parent825405c0c1b92c69cea283f97ee829ea3f23e3a4 (diff)
downloadllvm-6883a88fdbcb386d4d7d8d2714be7bd2e0e29ed9.tar.gz
llvm-6883a88fdbcb386d4d7d8d2714be7bd2e0e29ed9.tar.bz2
llvm-6883a88fdbcb386d4d7d8d2714be7bd2e0e29ed9.tar.xz
Add some advice
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/CodingStandards.html')
-rw-r--r--docs/CodingStandards.html34
1 files changed, 26 insertions, 8 deletions
diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html
index df6eb90b9b..36aced60a0 100644
--- a/docs/CodingStandards.html
+++ b/docs/CodingStandards.html
@@ -44,10 +44,11 @@
</ol></li>
<li><a href="#micro">The Low Level Issues</a>
<ol>
- <li><a href="#hl_assert">Assert Liberally</a></li>
- <li><a href="#hl_ns_std">Do not use 'using namespace std'</a></li>
- <li><a href="#hl_preincrement">Prefer Preincrement</a></li>
- <li><a href="#hl_avoidendl">Avoid <tt>std::endl</tt></a></li>
+ <li><a href="#ll_assert">Assert Liberally</a></li>
+ <li><a href="#ll_ns_std">Do not use 'using namespace std'</a></li>
+ <li><a href="#ll_virtual_anch">Provide a virtual method anchor for clases in headers</a></li>
+ <li><a href="#ll_preincrement">Prefer Preincrement</a></li>
+ <li><a href="#ll_avoidendl">Avoid <tt>std::endl</tt></a></li>
</ol></li>
</ol></li>
<li><a href="#seealso">See Also</a></li>
@@ -489,7 +490,7 @@ class itself... just make them private (or protected), and all is well.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
- <a name="hl_assert">Assert Liberally</a>
+ <a name="ll_assert">Assert Liberally</a>
</div>
<div class="doc_text">
@@ -537,7 +538,7 @@ assert(isa&lt;PHINode&gt;(Succ-&gt;front()) &amp;&amp; "Only works on PHId BBs!"
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
- <a name="hl_ns_std">Do not use 'using namespace std'</a>
+ <a name="ll_ns_std">Do not use 'using namespace std'</a>
</div>
<div class="doc_text">
@@ -572,7 +573,24 @@ namespace (and its parents), but should not use any others.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
- <a name="hl_preincrement">Prefer Preincrement</a>
+ <a name="ll_virtual_anch">Provide a virtual method anchor for clases in headers</a>
+</div>
+
+<div class="doc_text">
+
+<p>If a class is defined in a header file and has a v-table (either it has
+virtual methods or it derives from classes with virtual methods), it must
+always have at least one out-of-line virtual method in the class. Without
+this, the compiler will copy the vtable and RTTI into every .o file that
+#includes the header, bloating .o file sizes and increasing link times.
+</p>
+
+</div>
+
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+ <a name="ll_preincrement">Prefer Preincrement</a>
</div>
<div class="doc_text">
@@ -592,7 +610,7 @@ get in the habit of always using preincrement, and you won't have a problem.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
- <a name="hl_avoidendl">Avoid <tt>std::endl</tt></a>
+ <a name="ll_avoidendl">Avoid <tt>std::endl</tt></a>
</div>
<div class="doc_text">