summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-30 19:20:40 +0000
committerChris Lattner <sabre@nondot.org>2010-11-30 19:20:40 +0000
commit558f5d2a396c533ddceb9ff278fcb2b76641c0f2 (patch)
tree8cc8be4489e07d20e0accf748e501c7f200cfb9b /docs
parent0e1bcdf4f7547bb5f47ed5ff5f2409a8f72f3609 (diff)
forbid rtti and exceptions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/CodingStandards.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html
index ff00c816738..a2420805ec6 100644
--- a/docs/CodingStandards.html
+++ b/docs/CodingStandards.html
@@ -29,6 +29,7 @@
<li><a href="#ci_warningerrors">Treat Compiler Warnings Like
Errors</a></li>
<li><a href="#ci_portable_code">Write Portable Code</a></li>
+ <li><a href="#ci_rtti_exceptions">Do not use RTTI or Exceptions</a></li>
<li><a href="#ci_class_struct">Use of <tt>class</tt>/<tt>struct</tt> Keywords</a></li>
</ol></li>
</ol></li>
@@ -406,6 +407,28 @@ libSystem.</p>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
+<a name="ci_rtti_exceptions">Do not use RTTI or Exceptions</a>
+</div>
+<div class="doc_text">
+
+<p>LLVM does not use RTTI (e.g. dynamic_cast&lt;&gt;) or exceptions, in an
+effort to reduce code and executable size. These two language features violate
+the general C++ principle of "you only pay for what you use", causing executable
+bloat even if exceptions are never used in a code base, or if RTTI is never used
+for a class. Because of this, we turn them off globally in the code.
+</p>
+
+<p>
+That said, LLVM does make extensive use of a hand-rolled form of RTTI that use
+templates like <a href="ProgrammersManual.html#isa">isa&lt;&gt;, cast&lt;&gt;,
+and dyn_cast&lt;&gt;</a>. This form of RTTI is opt-in and can be added to any
+class. It is also substantially more efficient than dynamic_cast&lt;&gt;.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
<a name="ci_class_struct">Use of <tt>class</tt> and <tt>struct</tt> Keywords</a>
</div>
<div class="doc_text">