Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/clang-lm32
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3f22a64
Choose a base ref
...
head repository: m-labs/clang-lm32
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 84db6ff
Choose a head ref
Loading
Showing 673 changed files with 33,397 additions and 13,857 deletions.
89 changes: 89 additions & 0 deletions docs/AddressSanitizer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AddressSanitizer, a fast memory error detector</title>
<link type="text/css" rel="stylesheet" href="../menu.css">
<link type="text/css" rel="stylesheet" href="../content.css">
<style type="text/css">
td {
vertical-align: top;
}
</style>
</head>
<body>

<!--#include virtual="../menu.html.incl"-->

<div id="content">

<h1>AddressSanitizer</h1>
<ul>
<li> <a href="intro">Introduction</a>
<li> <a href="usage">Usage</a>
<ul><li> <a href="has_feature">__has_feature(address_sanitizer)</a></ul>
<li> <a href="platforms">Supported Platforms</a>
<li> <a href="limitations">Limitations</a>
<li> <a href="status">Current Status</a>
</ul>

<h2 id="intro">Introduction</h2>
AddressSanitizer is a fast memory error detector.
It consists of a compiler instrumentation module and a run-time library.
The tool can detect the following types of bugs:
<ul> <li> Out-of-bounds accesses to <ul><li>heap <li>stack <li>globals</ul>
<li> Use-after-free
<li> Use-after-return (to some extent)
<li> Double-free
</ul>
Typical slowdown introduced by AddressSanitizer is <b>2x</b>.

<h2 id="intro">Usage</h2>
In order to use AddressSanitizer simply compile and link your program with
<tt>-faddress-sanitizer</tt> flag.
To get a reasonable performance add <tt>-O1</tt> or higher.
If a bug is detected, the program will print an error message and exit with a
non-zero exit code.

<h3 id="has_feature">__has_feature(address_sanitizer)</h3>
In some cases one may need to execute different code depending on whether
AddressSanitizer is enabled.
<a href="LanguageExtensions.html#__has_feature_extension">__has_feature</a>
can be used for this purpose.
<pre>
#if defined(__has_feature) && __has_feature(address_sanitizer)
code that runs only under AddressSanitizer
#else
code that does not run under AddressSanitizer
#endif
</pre>

<h2 id="platforms">Supported Platforms</h2>
AddressSanitizer is supported on the following platforms:
<ul> <li>Linux <ul> <li> i386 <li> x86_64 <li> ARM </ul>
<li>Darwin <ul> <li> i386 <li> x86_64 </ul>
</ul>

<h2 id="limitations">Limitations</h2>
<ul>
<li> AddressSanitizer uses more real memory than a native run.
How much -- depends on the allocations sizes. The smaller the
allocations you make the bigger the overhead.
<li> On 64-bit platforms AddressSanitizer maps (but not reserves)
16+ Terabytes of virtual address space.
This means that tools like <tt>ulimit</tt> may not work as usually expected.
<li> Static linking is not supported.
</ul>


<h2 id="status">Current Status</h2>
AddressSanitizer is work-in-progress and is not yet fully functional in the LLVM/Clang head.
For the up-to-date usable version and full documentation refer to
<a href="http://code.google.com/p/address-sanitizer/">http://code.google.com/p/address-sanitizer</a>.


</div>
</body>
</html>
11 changes: 7 additions & 4 deletions docs/AutomaticReferenceCounting.html
Original file line number Diff line number Diff line change
@@ -581,7 +581,7 @@ <h1>Conversion of retainable object pointers</h1>
convert a value of retainable object pointer type to any
non-retainable type, or vice-versa, is ill-formed. For example, an
Objective-C object pointer shall not be converted to <tt>void*</tt>.
As an exception, cast to <tt>intptr_t</tt> is allowed becuase such
As an exception, cast to <tt>intptr_t</tt> is allowed because such
casts are not transferring ownership. The <a href="#objects.operands.casts">bridged
casts</a> may be used to perform these conversions where
necessary.</p>
@@ -1482,9 +1482,12 @@ <h1><tt>self</tt></h1>
<p>The <tt>self</tt> parameter variable of an Objective-C method is
never actually retained by the implementation. It is undefined
behavior, or at least dangerous, to cause an object to be deallocated
during a message send to that object. To make this
safe, <tt>self</tt> is implicitly <tt>const</tt> unless the method is
in the <a href="#family.semantics.init"><tt>init</tt> family</a>.</p>
during a message send to that object.</p>

<p>To make this safe, for Objective-C instance methods <tt>self</tt> is
implicitly <tt>const</tt> unless the method is in the <a
href="#family.semantics.init"><tt>init</tt> family</a>. Further, <tt>self</tt>
is <b>always</b> implicitly <tt>const</tt> within a class method.</p>

<div class="rationale"><p>Rationale: the cost of
retaining <tt>self</tt> in all methods was found to be prohibitive, as
18 changes: 18 additions & 0 deletions docs/LanguageExtensions.html
Original file line number Diff line number Diff line change
@@ -103,6 +103,10 @@ <h1>Clang Language Extensions</h1>
</ul>
</li>
<li><a href="#analyzerspecific">Static Analysis-Specific Extensions</a></li>
<li><a href="#dynamicanalyzerspecific">Dynamic Analysis-Specific Extensions</a></li>
<ul>
<li><a href="#address_sanitizer">AddressSanitizer</a></li>
</ul>
<li><a href="#threadsafety">Thread Safety Annotation Checking</a></li>
<ul>
<li><a href="#ts_noanal"><tt>no_thread_safety_analysis</tt></a></li>
@@ -211,6 +215,11 @@ <h3><a name="__has_feature_extension"> __has_feature and __has_extension</a></h3
non-standardized features, i.e. features not prefixed <code>c_</code>,
<code>cxx_</code> or <code>objc_</code>.</p>

<p id="has_feature_for_non_language_features">
Another use of <code>__has_feature</code> is to check for compiler features
not related to the language standard, such as e.g.
<a href="AddressSanitizer.html">AddressSanitizer</a>.

<p>If the <code>-pedantic-errors</code> option is given,
<code>__has_extension</code> is equivalent to <code>__has_feature</code>.</p>

@@ -715,6 +724,7 @@ <h2 id="checking_type_traits">Checks for Type Traits</h2>
<li><code>__is_polymorphic</code> (GNU, Microsoft)</li>
<li><code>__is_union</code> (GNU, Microsoft)</li>
<li><code>__is_literal(type)</code>: Determines whether the given type is a literal type</li>
<li><code>__is_final</code>: Determines whether the given type is declared with a <code>final</code> class-virt-specifier.</li>
<li><code>__underlying_type(type)</code>: Retrieves the underlying type for a given <code>enum</code> type. This trait is required to implement the C++11 standard library.</li>
</ul>

@@ -1272,6 +1282,14 @@ <h3 id="attr_retain_release">Objective-C retaining behavior attributes</h3>
<p>Query for these features with <tt>__has_attribute(ns_consumed)</tt>,
<tt>__has_attribute(ns_returns_retained)</tt>, etc.</p>

<!-- ======================================================================= -->
<h2 id="dynamicanalyzerspecific">Dynamic Analysis-Specific Extensions</h2>
<!-- ======================================================================= -->
<h3 id="address_sanitizer">AddressSanitizer</h3>
<p> Use <code>__has_feature(address_sanitizer)</code>
to check if the code is being built with <a
href="AddressSanitizer.html">AddressSanitizer</a>.
</p>

<!-- ======================================================================= -->
<h2 id="threadsafety">Thread-Safety Annotation Checking</h2>
Loading