forked from OSchip/llvm-project
parent
339ced4e34
commit
eaa262b5b8
|
@ -45,7 +45,7 @@ Typical slowdown introduced by AddressSanitizer is <b>2x</b>.
|
|||
<h2 id="howtobuild">How to build</h2>
|
||||
Follow the <a href="../get_started.html">clang build instructions</a>.
|
||||
|
||||
<h2 id="intro">Usage</h2>
|
||||
<h2 id="usage">Usage</h2>
|
||||
Simply compile and link your program with <tt>-faddress-sanitizer</tt> flag. <BR>
|
||||
To get a reasonable performance add <tt>-O1</tt> or higher. <BR>
|
||||
To get nicer stack traces in error messages add
|
||||
|
@ -93,7 +93,7 @@ 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)
|
||||
#if defined(__has_feature) && __has_feature(address_sanitizer)
|
||||
code that runs only under AddressSanitizer
|
||||
#else
|
||||
code that does not run under AddressSanitizer
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Static Analyzer Design Document: Memory Regions</title>
|
||||
|
@ -59,7 +61,7 @@ of structures) then the StoreManager can simply return 'unknown' (represented by
|
|||
concerns not only isolates the core analysis engine from the details of
|
||||
reasoning about program memory but also facilities the option of a client of the
|
||||
path-sensitive engine to easily swap in different StoreManager implementations
|
||||
that internally reason about program memory in very different ways.</pp>
|
||||
that internally reason about program memory in very different ways.</p>
|
||||
|
||||
<p>The rest of this document is divided into two parts. We first discuss region
|
||||
taxonomy and the semantics of regions. We then discuss the StoreManager
|
||||
|
@ -102,7 +104,7 @@ typedef struct s my_type;
|
|||
void *p;
|
||||
int *q = (int*) p;
|
||||
char *r = (char*) p;
|
||||
</pre
|
||||
</pre>
|
||||
|
||||
<p>Thus we need to canonicalize the MemRegion which is used in binding and
|
||||
retrieving.</p>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Objective-C Automatic Reference Counting (ARC)</title>
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="../content.css">
|
||||
<style type="text/css">
|
||||
/* Collapse the items in the ToC to the left. */
|
||||
div#toc ul {
|
||||
|
@ -26,7 +28,7 @@ div div div div h1 { margin: 1.12em 0 }
|
|||
span.term { font-style: italic; font-weight: bold }
|
||||
</style>
|
||||
|
||||
<script lang="javascript">
|
||||
<script type="text/javascript">
|
||||
/// A little script to recursively build a table of contents.
|
||||
function buildTOC(div, toc, ancestry) {
|
||||
var children = div.childNodes;
|
||||
|
@ -739,7 +741,7 @@ semantics as the respective operation would have on an <tt>void*</tt>
|
|||
lvalue with the same alignment and non-ownership qualification.</p>
|
||||
|
||||
<p><span class="term">Reading</span> occurs when performing a
|
||||
lvalue-to-rvalue conversion on an object lvalue.
|
||||
lvalue-to-rvalue conversion on an object lvalue.</p>
|
||||
|
||||
<ul>
|
||||
<li>For <tt>__weak</tt> objects, the current pointee is retained and
|
||||
|
@ -749,10 +751,9 @@ release of the pointee.</li>
|
|||
<li>For all other objects, the lvalue is loaded with primitive
|
||||
semantics.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p><span class="term">Assignment</span> occurs when evaluating
|
||||
an assignment operator. The semantics vary based on the qualification:
|
||||
an assignment operator. The semantics vary based on the qualification:</p>
|
||||
<ul>
|
||||
<li>For <tt>__strong</tt> objects, the new pointee is first retained;
|
||||
second, the lvalue is loaded with primitive semantics; third, the new
|
||||
|
@ -771,11 +772,10 @@ stored into the lvalue using primitive semantics.</li>
|
|||
<li>For <tt>__autoreleasing</tt> objects, the new pointee is retained,
|
||||
autoreleased, and stored into the lvalue using primitive semantics.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p><span class="term">Initialization</span> occurs when an object's
|
||||
lifetime begins, which depends on its storage duration.
|
||||
Initialization proceeds in two stages:
|
||||
Initialization proceeds in two stages:</p>
|
||||
<ol>
|
||||
<li>First, a null pointer is stored into the lvalue using primitive
|
||||
semantics. This step is skipped if the object
|
||||
|
@ -784,7 +784,6 @@ is <tt>__unsafe_unretained</tt>.</li>
|
|||
evaluated and then assigned into the object using the usual assignment
|
||||
semantics.</li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<p><span class="term">Destruction</span> occurs when an object's
|
||||
lifetime ends. In all cases it is semantically equivalent to
|
||||
|
@ -863,7 +862,7 @@ is left.</p>
|
|||
<p>A program is ill-formed if an expression of type <tt>T*</tt> is
|
||||
converted, explicitly or implicitly, to the type <tt>U*</tt>,
|
||||
where <tt>T</tt> and <tt>U</tt> have different ownership
|
||||
qualification, unless:
|
||||
qualification, unless:</p>
|
||||
<ul>
|
||||
<li><tt>T</tt> is qualified with <tt>__strong</tt>,
|
||||
<tt>__autoreleasing</tt>, or <tt>__unsafe_unretained</tt>, and
|
||||
|
@ -876,9 +875,8 @@ qualification, unless:
|
|||
<li>the conversion is a
|
||||
well-formed <a href="#ownership.restrictions.pass_by_writeback">pass-by-writeback</a>.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>The analogous rule applies to <tt>T&</tt> and <tt>U&</tt> in
|
||||
<p>The analogous rule applies to <tt>T&</tt> and <tt>U&</tt> in
|
||||
Objective-C++.</p>
|
||||
|
||||
<div class="rationale"><p>Rationale: these rules provide a reasonable
|
||||
|
@ -933,7 +931,7 @@ where <tt>oq</tt> is an ownership qualifier, then the argument is a
|
|||
candidate for <span class="term">pass-by-writeback</span> if:</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>oq</tt> is <tt>__strong</tt> or <tt>__weak</tt>, and
|
||||
<li><tt>oq</tt> is <tt>__strong</tt> or <tt>__weak</tt>, and</li>
|
||||
<li>it would be legal to initialize a <tt>T __strong *</tt> with
|
||||
a <tt>U __strong *</tt>.</li>
|
||||
</ul>
|
||||
|
@ -946,7 +944,7 @@ implicit conversion sequence not requiring a pass-by-writeback.</p>
|
|||
not have a legal form:</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>&var</tt>, where <tt>var</tt> is a scalar variable of
|
||||
<li><tt>&var</tt>, where <tt>var</tt> is a scalar variable of
|
||||
automatic storage duration with retainable object pointer type</li>
|
||||
<li>a conditional expression where the second and third operands are
|
||||
both legal forms</li>
|
||||
|
@ -963,7 +961,7 @@ that the user will see confusing aliasing problems due to the
|
|||
implementation, below, where their store to the writeback temporary is
|
||||
not immediately seen in the original argument variable.</p></div>
|
||||
|
||||
<p>A pass-by-writeback is evaluated as follows:
|
||||
<p>A pass-by-writeback is evaluated as follows:</p>
|
||||
<ol>
|
||||
<li>The argument is evaluated to yield a pointer <tt>p</tt> of
|
||||
type <tt>U oq *</tt>.</li>
|
||||
|
@ -978,7 +976,7 @@ not immediately seen in the original argument variable.</p></div>
|
|||
actual call.</li>
|
||||
<li>After the call completes, the temporary is loaded with primitive
|
||||
semantics, and that value is assigned into <tt>*p</tt>.</li>
|
||||
</ol></p>
|
||||
</ol>
|
||||
|
||||
<div class="rationale"><p>Rationale: this is all admittedly
|
||||
convoluted. In an ideal world, we would see that a local variable is
|
||||
|
@ -1055,7 +1053,6 @@ it is implicitly qualified with <tt>__unsafe_unretained</tt>;</li>
|
|||
<li>otherwise, it is implicitly qualified
|
||||
with <tt>__autoreleasing</tt>.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<div class="rationale"><p>Rationale: <tt>__autoreleasing</tt> exists
|
||||
mostly for this case, the Cocoa convention for out-parameters. Since
|
||||
|
@ -1101,7 +1098,7 @@ template argument was deduced or explicitly specified. </p>
|
|||
family</span>, which is a conventional set of behaviors ascribed to it
|
||||
by the Cocoa conventions.</p>
|
||||
|
||||
<p>A method is in a certain method family if:
|
||||
<p>A method is in a certain method family if:</p>
|
||||
<ul>
|
||||
<li>it has a <tt>objc_method_family</tt> attribute placing it in that
|
||||
family; or if not that,</li>
|
||||
|
@ -1109,7 +1106,7 @@ by the Cocoa conventions.</p>
|
|||
it in a different or no family, and</li>
|
||||
<li>its selector falls into the corresponding selector family, and</li>
|
||||
<li>its signature obeys the added restrictions of the method family.</li>
|
||||
</ul></p>
|
||||
</ul>
|
||||
|
||||
<p>A selector is in a certain selector family if, ignoring any leading
|
||||
underscores, the first component of the selector either consists
|
||||
|
@ -1132,7 +1129,7 @@ declares or contains a call to an <tt>init</tt> method whose return
|
|||
type is neither <tt>id</tt> nor a pointer to a super-class or
|
||||
sub-class of the declaring class (if the method was declared on
|
||||
a class) or the static receiver type of the call (if it was declared
|
||||
on a protocol).</p>
|
||||
on a protocol).
|
||||
|
||||
<div class="rationale"><p>Rationale: there are a fair number of existing
|
||||
methods with <tt>init</tt>-like selectors which nonetheless don't
|
||||
|
@ -1361,14 +1358,13 @@ clearer.</p></div>
|
|||
|
||||
<p>A program is ill-formed if it contains a method definition, message
|
||||
send, or <tt>@selector</tt> expression for any of the following
|
||||
selectors:
|
||||
selectors:</p>
|
||||
<ul>
|
||||
<li><tt>autorelease</tt></li>
|
||||
<li><tt>release</tt></li>
|
||||
<li><tt>retain</tt></li>
|
||||
<li><tt>retainCount</tt></li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<div class="rationale"><p>Rationale: <tt>retainCount</tt> is banned
|
||||
because ARC robs it of consistent semantics. The others were banned
|
||||
|
@ -1519,7 +1515,7 @@ retained during enumeration, and the collection itself cannot be
|
|||
synchronously modified. It can be overridden by explicitly qualifying
|
||||
the variable with <tt>__strong</tt>, which will make the variable
|
||||
mutable again and cause the loop to retain the objects it
|
||||
encounters.</div>
|
||||
encounters.</p></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1540,7 +1536,7 @@ retain during capture.</p>
|
|||
|
||||
<p><tt>__block</tt> variables of retainable object owner type are
|
||||
moved off the stack by initializing the heap copy with the result of
|
||||
moving from the stack copy.</tt></p>
|
||||
moving from the stack copy.</p>
|
||||
|
||||
<p>With the exception of retains done as part of initializing
|
||||
a <tt>__strong</tt> parameter variable or reading a <tt>__weak</tt>
|
||||
|
@ -1555,7 +1551,7 @@ used only as an argument to a call.</p>
|
|||
<h1>Exceptions</h1>
|
||||
|
||||
<p>By default in Objective C, ARC is not exception-safe for normal
|
||||
releases:
|
||||
releases:</p>
|
||||
<ul>
|
||||
<li>It does not end the lifetime of <tt>__strong</tt> variables when
|
||||
their scopes are abnormally terminated by an exception.</li>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Clang Driver Manual</title>
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../content.css" />
|
||||
<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;
|
||||
|
@ -19,26 +21,29 @@
|
|||
|
||||
<ul>
|
||||
<li><a href="#intro">Introduction</a></li>
|
||||
<li><a href="#features">Features and Goals</a></li>
|
||||
<li><a href="#features">Features and Goals</a>
|
||||
<ul>
|
||||
<li><a href="#gcccompat">GCC Compatibility</a></li>
|
||||
<li><a href="#components">Flexible</a></li>
|
||||
<li><a href="#performance">Low Overhead</a></li>
|
||||
<li><a href="#simple">Simple</a></li>
|
||||
</ul>
|
||||
<li><a href="#design">Design</a></li>
|
||||
</li>
|
||||
<li><a href="#design">Design</a>
|
||||
<ul>
|
||||
<li><a href="#int_intro">Internals Introduction</a></li>
|
||||
<li><a href="#int_overview">Design Overview</a></li>
|
||||
<li><a href="#int_notes">Additional Notes</a></li>
|
||||
<li><a href="#int_notes">Additional Notes</a>
|
||||
<ul>
|
||||
<li><a href="#int_compilation">The Compilation Object</a></li>
|
||||
<li><a href="#int_unified_parsing">Unified Parsing & Pipelining</a></li>
|
||||
<li><a href="#int_toolchain_translation">ToolChain Argument Translation</a></li>
|
||||
<li><a href="#int_unused_warnings">Unused Argument Warnings</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#int_gcc_concepts">Relation to GCC Driver Concepts</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
@ -168,11 +173,12 @@
|
|||
distinct stages which manipulate these data structures, and
|
||||
the blue components are important helper classes. </p>
|
||||
|
||||
<center>
|
||||
<a href="DriverArchitecture.png" alt="Driver Architecture Diagram">
|
||||
<img width=400 src="DriverArchitecture.png">
|
||||
<div style="text-align:center">
|
||||
<a href="DriverArchitecture.png">
|
||||
<img width=400 src="DriverArchitecture.png"
|
||||
alt="Driver Architecture Diagram">
|
||||
</a>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<!--=======================================================================-->
|
||||
<h3><a name="int_stages">Driver Stages</a></h3>
|
||||
|
@ -495,7 +501,7 @@
|
|||
embedded in specs is in the Tool specific argument
|
||||
translation routines. The parts of specs which control the
|
||||
compilation pipeline are generally part of
|
||||
the <ii>Pipeline</ii> stage.</p>
|
||||
the <i>Pipeline</i> stage.</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>"Clang" CFE Internals Manual</title>
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../content.css" />
|
||||
<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;
|
||||
|
@ -29,13 +31,9 @@ td {
|
|||
</ul>
|
||||
</li>
|
||||
<li><a href="#libdriver">The Driver Library</a>
|
||||
<ul>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#pch">Precompiled Headers</a>
|
||||
<li><a href="#libfrontend">The Frontend Library</a>
|
||||
<ul>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#liblex">The Lexer and Preprocessor Library</a>
|
||||
<ul>
|
||||
|
@ -47,8 +45,6 @@ td {
|
|||
</ul>
|
||||
</li>
|
||||
<li><a href="#libparse">The Parser Library</a>
|
||||
<ul>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#libast">The AST Library</a>
|
||||
<ul>
|
||||
|
@ -135,8 +131,8 @@ implemented. A representative example of a diagnostic is:</p>
|
|||
|
||||
<pre>
|
||||
t.c:38:15: error: invalid operands to binary expression ('int *' and '_Complex float')
|
||||
<font color="darkgreen">P = (P-42) + Gamma*4;</font>
|
||||
<font color="blue">~~~~~~ ^ ~~~~~~~</font>
|
||||
<span style="color:darkgreen">P = (P-42) + Gamma*4;</span>
|
||||
<span style="color:blue">~~~~~~ ^ ~~~~~~~</span>
|
||||
</pre>
|
||||
|
||||
<p>In this example, you can see the English translation, the severity (error),
|
||||
|
@ -265,7 +261,7 @@ including variable names, types, labels, etc. The 'select' format can be
|
|||
used to achieve this sort of thing in a localizable way, see below.</p>
|
||||
|
||||
<!-- ==================================== -->
|
||||
<h4>Formatting a Diagnostic Argument</a></h4>
|
||||
<h4>Formatting a Diagnostic Argument</h4>
|
||||
<!-- ==================================== -->
|
||||
|
||||
<p>Arguments to diagnostics are fully typed internally, and come from a couple
|
||||
|
@ -575,7 +571,7 @@ the <code>CharSourceRange</code> class.</p>
|
|||
<!-- ======================================================================= -->
|
||||
|
||||
<p>The clang Driver and library are documented <a
|
||||
href="DriverInternals.html">here<a>.<p>
|
||||
href="DriverInternals.html">here</a>.<p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="pch">Precompiled Headers</h2>
|
||||
|
@ -685,7 +681,6 @@ lexer/preprocessor system on a per-token basis:
|
|||
<li><b>NeedsCleaning</b> - This flag is set if the original spelling for the
|
||||
token includes a trigraph or escaped newline. Since this is uncommon,
|
||||
many pieces of code can fast-path on tokens that did not need cleaning.
|
||||
</p>
|
||||
</ol>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -905,13 +900,13 @@ on the annotated lines. In this example, we expect to get:</p>
|
|||
<pre>
|
||||
<b>test.c:6:1: error: indirection requires pointer operand ('foo' invalid)</b>
|
||||
*X; // error
|
||||
<font color="blue">^~</font>
|
||||
<span style="color:blue">^~</span>
|
||||
<b>test.c:7:1: error: indirection requires pointer operand ('foo' invalid)</b>
|
||||
**Y; // error
|
||||
<font color="blue">^~~</font>
|
||||
<span style="color:blue">^~~</span>
|
||||
<b>test.c:8:1: error: indirection requires pointer operand ('foo' invalid)</b>
|
||||
**Z; // error
|
||||
<font color="blue">^~~</font>
|
||||
<span style="color:blue">^~~</span>
|
||||
</pre>
|
||||
|
||||
<p>While this example is somewhat silly, it illustrates the point: we want to
|
||||
|
@ -1726,7 +1721,7 @@ interacts with constant evaluation:</p>
|
|||
|
||||
<p>To add an attribute, you'll have to add it to the list of attributes, add it
|
||||
to the parsing phase, and look for it in the AST scan.
|
||||
<a href="http://llvm.org/viewvc/llvm-project?view=rev&revision=124217">r124217</a>
|
||||
<a href="http://llvm.org/viewvc/llvm-project?view=rev&revision=124217">r124217</a>
|
||||
has a good example of adding a warning attribute.</p>
|
||||
|
||||
<p>(Beware that this hasn't been reviewed/fixed by the people who designed the
|
||||
|
|
|
@ -103,11 +103,12 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li><a href="#analyzerspecific">Static Analysis-Specific Extensions</a></li>
|
||||
<li><a href="#dynamicanalyzerspecific">Dynamic Analysis-Specific Extensions</a></li>
|
||||
<li><a href="#dynamicanalyzerspecific">Dynamic Analysis-Specific Extensions</a>
|
||||
<ul>
|
||||
<li><a href="#address_sanitizer">AddressSanitizer</a></li>
|
||||
</ul>
|
||||
<li><a href="#threadsafety">Thread Safety Annotation Checking</a></li>
|
||||
</li>
|
||||
<li><a href="#threadsafety">Thread Safety Annotation Checking</a>
|
||||
<ul>
|
||||
<li><a href="#ts_noanal"><tt>no_thread_safety_analysis</tt></a></li>
|
||||
<li><a href="#ts_lockable"><tt>lockable</tt></a></li>
|
||||
|
@ -128,6 +129,7 @@
|
|||
<li><a href="#ts_elr"><tt>exclusive_locks_required(...)</tt></a></li>
|
||||
<li><a href="#ts_slr"><tt>shared_locks_required(...)</tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
|
@ -541,7 +543,7 @@ support for delegating constructors is enabled.</p>
|
|||
<tt>__has_extension(cxx_deleted_functions)</tt> to determine if support for
|
||||
deleted function definitions (with <tt>= delete</tt>) is enabled.</p>
|
||||
|
||||
<h4 id="cxx_explicit_conversions">C++11 explicit conversion functions</h3>
|
||||
<h4 id="cxx_explicit_conversions">C++11 explicit conversion functions</h4>
|
||||
<p>Use <tt>__has_feature(cxx_explicit_conversions)</tt> to determine if support for <tt>explicit</tt> conversion functions is enabled.</p>
|
||||
|
||||
<h4 id="cxx_generalized_initializers">C++11 generalized initializers</h4>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Precompiled Headers (PCH)</title>
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../content.css" />
|
||||
<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;
|
||||
|
@ -155,7 +157,7 @@ without duplicating the data from the common headers for every file.</p>
|
|||
|
||||
<h2 id="contents">Precompiled Header Contents</h2>
|
||||
|
||||
<img src="PCHLayout.png" align="right" alt="Precompiled header layout">
|
||||
<img src="PCHLayout.png" style="float:right" alt="Precompiled header layout">
|
||||
|
||||
<p>Clang's precompiled headers are organized into several different
|
||||
blocks, each of which contains the serialized representation of a part
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Pretokenized Headers (PTH)</title>
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../content.css" />
|
||||
<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;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Clang 3.0 Release Notes</title>
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../content.css" />
|
||||
<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;
|
||||
|
@ -17,7 +19,7 @@ td {
|
|||
|
||||
<h1>Clang 3.0 Release Notes</h1>
|
||||
|
||||
<img align=right src="http://llvm.org/img/DragonSmall.png"
|
||||
<img style="float:right" src="http://llvm.org/img/DragonSmall.png"
|
||||
width="136" height="136" alt="LLVM Dragon Logo">
|
||||
|
||||
<ul>
|
||||
|
@ -379,5 +381,6 @@ should likely pick up proper release notes in 3.1.
|
|||
|
||||
-->
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Clang Compiler User's Manual</title>
|
||||
<link type="text/css" rel="stylesheet" href="../menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../content.css" />
|
||||
<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;
|
||||
|
@ -263,10 +265,10 @@ when this is enabled, Clang will print something like:
|
|||
When this option is enabled, Clang will use colors to highlight
|
||||
specific parts of the diagnostic, e.g.,
|
||||
<pre>
|
||||
<b><font color="black">test.c:28:8: <font color="magenta">warning</font>: extra tokens at end of #endif directive [-Wextra-tokens]</font></b>
|
||||
<b><span style="color:black">test.c:28:8: <span style="color:magenta">warning</span>: extra tokens at end of #endif directive [-Wextra-tokens]</span></b>
|
||||
#endif bad
|
||||
<font color="green">^</font>
|
||||
<font color="green">//</font>
|
||||
<span style="color:green">^</span>
|
||||
<span style="color:green">//</span>
|
||||
</pre>
|
||||
|
||||
<p>When this is disabled, Clang will just print:</p>
|
||||
|
@ -305,8 +307,7 @@ Changes diagnostic output format to better match IDEs and command line tools.</d
|
|||
<dt id="opt_fdiagnostics-show-name"><b>-f[no-]diagnostics-show-name</b>:
|
||||
Enable the display of the diagnostic name.</dt>
|
||||
<dd>This option, which defaults to off, controls whether or not
|
||||
Clang prints the associated name.</dd>
|
||||
<br>
|
||||
Clang prints the associated name.<p></p></dd>
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<dt id="opt_fdiagnostics-show-option"><b>-f[no-]diagnostics-show-option</b>:
|
||||
Enable <tt>[-Woption]</tt> information in diagnostic line.</dt>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Get Involved</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Universal Driver</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Source Annotations</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -106,7 +106,7 @@ int foo(int *p, int *q) {
|
|||
<p>Running <tt>scan-build</tt> over this source produces the following
|
||||
output:</p>
|
||||
|
||||
<img src="images/example_attribute_nonnull.png">
|
||||
<img src="images/example_attribute_nonnull.png" alt="example attribute nonnull">
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<h2 id="macosx">Mac OS X API Annotations</h2>
|
||||
|
@ -192,7 +192,7 @@ use 'cf_returns_retained'.</p>
|
|||
|
||||
<p>Running <tt>scan-build</tt> on this source file produces the following output:</p>
|
||||
|
||||
<img src="images/example_ns_returns_retained.png">
|
||||
<img src="images/example_ns_returns_retained.png" alt="example returns retained">
|
||||
|
||||
<h4 id="attr_ns_returns_not_retained">Attribute 'ns_returns_not_retained'
|
||||
(Clang-specific)</h4>
|
||||
|
@ -242,7 +242,7 @@ Cocoa object. This distinction is important for two reasons:</p>
|
|||
<li>Because Core Foundation is a C API, the analyzer cannot always tell that a
|
||||
pointer return value refers to a Core Foundation object. In contrast, it is
|
||||
trivial for the analyzer to recognize if a pointer refers to a Cocoa object
|
||||
(given the Objective-C type system).</p>
|
||||
(given the Objective-C type system).
|
||||
</ul>
|
||||
|
||||
<p><b>Placing on C functions</b>: When placing the attribute
|
||||
|
@ -311,16 +311,16 @@ CFDateRef returnsRetainedCFDate() {
|
|||
|
||||
<p>Running <tt>scan-build</tt> on this example produces the following output:</p>
|
||||
|
||||
<img src="images/example_cf_returns_retained.png">
|
||||
<img src="images/example_cf_returns_retained.png" alt="example returns retained">
|
||||
|
||||
</p>When the above code is compiled using Objective-C garbage collection (i.e.,
|
||||
<p>When the above code is compiled using Objective-C garbage collection (i.e.,
|
||||
code is compiled with the flag <tt>-fobjc-gc</tt> or <tt>-fobjc-gc-only</tt>),
|
||||
<tt>scan-build</tt> produces both the above error (with slightly different text
|
||||
to indicate the code uses garbage collection) as well as the following warning,
|
||||
which indicates a leak that occurs <em>only</em> when using garbage
|
||||
collection:</p>
|
||||
|
||||
<img src="images/example_cf_returns_retained_gc.png">
|
||||
<img src="images/example_cf_returns_retained_gc.png" alt="example returns retained gc">
|
||||
|
||||
<h4 id="attr_cf_returns_not_retained">Attribute 'cf_returns_not_retained'
|
||||
(Clang-specific)</h4>
|
||||
|
|
|
@ -3,9 +3,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Available Checks</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
<style type="text/css">
|
||||
tr:first-child { width:20%; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -24,103 +27,103 @@
|
|||
<th><h4>Description</h4></th>
|
||||
</tr>-->
|
||||
<tr>
|
||||
<td width="20%"><b>core.AdjustedReturnValue</b></td><td>Check to see if the return value of a function call is different than the caller expects (e.g., from calls through function pointers).</td>
|
||||
<td><b>core.AdjustedReturnValue</b></td><td>Check to see if the return value of a function call is different than the caller expects (e.g., from calls through function pointers).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.AttributeNonNull</b></td><td>Check for null pointers passed as arguments to a function whose arguments are marked with the 'nonnull' attribute.</td>
|
||||
<td><b>core.AttributeNonNull</b></td><td>Check for null pointers passed as arguments to a function whose arguments are marked with the 'nonnull' attribute.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.CallAndMessage</b></td><td>Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).</td>
|
||||
<td><b>core.CallAndMessage</b></td><td>Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.DivideZero</b></td><td>Check for division by zero.</td>
|
||||
<td><b>core.DivideZero</b></td><td>Check for division by zero.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.NullDereference</b></td><td>Check for dereferences of null pointers.</td>
|
||||
<td><b>core.NullDereference</b></td><td>Check for dereferences of null pointers.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.StackAddressEscape</b></td><td>Check that addresses to stack memory do not escape the function.</td>
|
||||
<td><b>core.StackAddressEscape</b></td><td>Check that addresses to stack memory do not escape the function.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.UndefinedBinaryOperatorResult</b></td><td>Check for undefined results of binary operators.</td>
|
||||
<td><b>core.UndefinedBinaryOperatorResult</b></td><td>Check for undefined results of binary operators.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.VLASize</b></td><td>Check for declarations of VLA of undefined or zero size.</td>
|
||||
<td><b>core.VLASize</b></td><td>Check for declarations of VLA of undefined or zero size.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.builtin.BuiltinFunctions</b></td><td>Evaluate compiler builtin functions (e.g., alloca()).</td>
|
||||
<td><b>core.builtin.BuiltinFunctions</b></td><td>Evaluate compiler builtin functions (e.g., alloca()).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.builtin.NoReturnFunctions</b></td><td>Evaluate "panic" functions that are known to not return to the caller.</td>
|
||||
<td><b>core.builtin.NoReturnFunctions</b></td><td>Evaluate "panic" functions that are known to not return to the caller.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.uninitialized.ArraySubscript</b></td><td>Check for uninitialized values used as array subscripts.</td>
|
||||
<td><b>core.uninitialized.ArraySubscript</b></td><td>Check for uninitialized values used as array subscripts.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.uninitialized.Assign</b></td><td>Check for assigning uninitialized values.</td>
|
||||
<td><b>core.uninitialized.Assign</b></td><td>Check for assigning uninitialized values.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.uninitialized.Branch</b></td><td>Check for uninitialized values used as branch conditions.</td>
|
||||
<td><b>core.uninitialized.Branch</b></td><td>Check for uninitialized values used as branch conditions.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.uninitialized.CapturedBlockVariable</b></td><td>Check for blocks that capture uninitialized values.</td>
|
||||
<td><b>core.uninitialized.CapturedBlockVariable</b></td><td>Check for blocks that capture uninitialized values.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>core.uninitialized.UndefReturn</b></td><td>Check for uninitialized values being returned to the caller.</td>
|
||||
<td><b>core.uninitialized.UndefReturn</b></td><td>Check for uninitialized values being returned to the caller.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>deadcode.DeadStores</b></td><td>Check for values stored to variables that are never read afterwards.</td>
|
||||
<td><b>deadcode.DeadStores</b></td><td>Check for values stored to variables that are never read afterwards.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>deadcode.IdempotentOperations</b></td><td>Warn about idempotent operations.</td>
|
||||
<td><b>deadcode.IdempotentOperations</b></td><td>Warn about idempotent operations.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.API</b></td><td>Check for proper uses of various Mac OS X APIs.</td>
|
||||
<td><b>osx.API</b></td><td>Check for proper uses of various Mac OS X APIs.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.AtomicCAS</b></td><td>Evaluate calls to OSAtomic functions.</td>
|
||||
<td><b>osx.AtomicCAS</b></td><td>Evaluate calls to OSAtomic functions.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.SecKeychainAPI</b></td><td>Check for proper uses of Secure Keychain APIs.</td>
|
||||
<td><b>osx.SecKeychainAPI</b></td><td>Check for proper uses of Secure Keychain APIs.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.AtSync</b></td><td>Check for null pointers used as mutexes for @synchronized.</td>
|
||||
<td><b>osx.cocoa.AtSync</b></td><td>Check for null pointers used as mutexes for @synchronized.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.ClassRelease</b></td><td>Check for sending 'retain', 'release', or 'autorelease' directly to a Class.</td>
|
||||
<td><b>osx.cocoa.ClassRelease</b></td><td>Check for sending 'retain', 'release', or 'autorelease' directly to a Class.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.IncompatibleMethodTypes</b></td><td>Warn about Objective-C method signatures with type incompatibilities.</td>
|
||||
<td><b>osx.cocoa.IncompatibleMethodTypes</b></td><td>Warn about Objective-C method signatures with type incompatibilities.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.NSAutoreleasePool</b></td><td>Warn for suboptimal uses of NSAutoreleasePool in Objective-C GC mode.</td>
|
||||
<td><b>osx.cocoa.NSAutoreleasePool</b></td><td>Warn for suboptimal uses of NSAutoreleasePool in Objective-C GC mode.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.NSError</b></td><td>Check usage of NSError** parameters.</td>
|
||||
<td><b>osx.cocoa.NSError</b></td><td>Check usage of NSError** parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.NilArg</b></td><td>Check for prohibited nil arguments to ObjC method calls.</td>
|
||||
<td><b>osx.cocoa.NilArg</b></td><td>Check for prohibited nil arguments to ObjC method calls.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.RetainCount</b></td><td>Check for leaks and improper reference count management.</td>
|
||||
<td><b>osx.cocoa.RetainCount</b></td><td>Check for leaks and improper reference count management.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.UnusedIvars</b></td><td>Warn about private ivars that are never used.</td>
|
||||
<td><b>osx.cocoa.UnusedIvars</b></td><td>Warn about private ivars that are never used.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.cocoa.VariadicMethodTypes</b></td><td>Check for passing non-Objective-C types to variadic methods that expect only Objective-C types.</td>
|
||||
<td><b>osx.cocoa.VariadicMethodTypes</b></td><td>Check for passing non-Objective-C types to variadic methods that expect only Objective-C types.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.coreFoundation.CFError</b></td><td>Check usage of CFErrorRef* parameters.</td>
|
||||
<td><b>osx.coreFoundation.CFError</b></td><td>Check usage of CFErrorRef* parameters.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.coreFoundation.CFNumber</b></td><td>Check for proper uses of CFNumberCreate.</td>
|
||||
<td><b>osx.coreFoundation.CFNumber</b></td><td>Check for proper uses of CFNumberCreate.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>osx.coreFoundation.CFRetainRelease</b></td><td>Check for null arguments to CFRetain/CFRelease.</td>
|
||||
<td><b>osx.coreFoundation.CFRetainRelease</b></td><td>Check for null arguments to CFRetain/CFRelease.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"><b>unix.API</b></td><td>Check calls to various UNIX/Posix functions.</td>
|
||||
<td><b>unix.API</b></td><td>Check calls to various UNIX/Posix functions.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Checker Developer Manual</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div id="content">
|
||||
|
||||
<h1><font color=red>This Page Is Under Construction</font></h1>
|
||||
<h1 style="color:red">This Page Is Under Construction</h1>
|
||||
|
||||
<h1>Checker Developer Manual</h1>
|
||||
|
||||
|
@ -196,7 +196,8 @@ values (e.g., the number 1).
|
|||
inter-procedural analysis). Also, it uses a simple range tracking based
|
||||
solver to model symbolic execution.</li>
|
||||
|
||||
<li>Consult the <a href="http://llvm.org/bugs/buglist.cgi?query_format=advanced&bug_status=NEW&bug_status=REOPENED&version=trunk&component=Static%20Analyzer&product=clang">Bugzilla database</a>
|
||||
<li>Consult the <a
|
||||
href="http://llvm.org/bugs/buglist.cgi?query_format=advanced&bug_status=NEW&bug_status=REOPENED&version=trunk&component=Static%20Analyzer&product=clang">Bugzilla database</a>
|
||||
to get some ideas for new checkers and consider starting with improving/fixing
|
||||
bugs in the existing checkers.</li>
|
||||
</ul>
|
||||
|
@ -211,13 +212,13 @@ using namespace clang;
|
|||
using namespace ento;
|
||||
|
||||
namespace {
|
||||
class NewChecker: public Checker< check::PreStmt<CallExpr> > {
|
||||
class NewChecker: public Checker< check::PreStmt<CallExpr> > {
|
||||
public:
|
||||
void checkPreStmt(const CallExpr *CE, CheckerContext &Ctx) const {}
|
||||
void checkPreStmt(const CallExpr *CE, CheckerContext &Ctx) const {}
|
||||
}
|
||||
}
|
||||
void ento::registerNewChecker(CheckerManager &mgr) {
|
||||
mgr.registerChecker<NewChecker>();
|
||||
void ento::registerNewChecker(CheckerManager &mgr) {
|
||||
mgr.registerChecker<NewChecker>();
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Analyzer Development: C++ Support</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -31,18 +31,20 @@ decent analysis of C++. This list is also not complete; new tasks
|
|||
will be added as deemed necessary.</p>
|
||||
|
||||
<ul>
|
||||
<li>Control-Flow Graph Enhancements:</li>
|
||||
<li>Control-Flow Graph Enhancements:
|
||||
<ul>
|
||||
<li>Model C++ destructors</li>
|
||||
<li>Model C++ initializers (in constructors)</li>
|
||||
</ul>
|
||||
<li>Path-Sensitive Analysis Engine (GRExprEngine):</li>
|
||||
</li>
|
||||
<li>Path-Sensitive Analysis Engine (GRExprEngine):
|
||||
<ul>
|
||||
<li>Model C++ casts</li>
|
||||
<li>Model C++ constructors</li>
|
||||
<li>Model C++ destructors</li>
|
||||
<li>Model <tt>new</tt> and <tt>delete</tt></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Filing Bugs and Feature Requests</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,38 +3,10 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Clang Static Analyzer</title>
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="page">
|
||||
<!--#include virtual="menu.html.incl"-->
|
||||
<div id="content">
|
||||
|
||||
|
||||
<table style="margin-top:0px" width="100%" border="0" cellpadding="0px" cellspacing="0">
|
||||
<tr><td>
|
||||
|
||||
<h1>Clang Static Analyzer</h1>
|
||||
|
||||
<p>The Clang Static Analyzer is source code analysis tool that find bugs in C
|
||||
and Objective-C programs.</p>
|
||||
|
||||
<p>Currently it can be run either as a <a href="/scan-build.html">standalone
|
||||
tool</a> or <a href="/xcode.html">within Xcode</a>. The standalone tool is
|
||||
invoked from the command-line, and is intended to be run in tandem with a build
|
||||
of a codebase.</p>
|
||||
|
||||
<p>The analyzer is 100% open source and is part of the <a
|
||||
href="http://clang.llvm.org">Clang</a> project. Like the rest of Clang, the
|
||||
analyzer is implemented as a C++ library that can be used by other tools and
|
||||
applications.</p>
|
||||
|
||||
<h2>Download</h2>
|
||||
|
||||
<!-- Generated from: http://www.spiffycorners.com/index.php -->
|
||||
<!-- Generated from: http://www.spiffycorners.com/index.php -->
|
||||
|
||||
<style type="text/css">
|
||||
.spiffy{display:block}
|
||||
|
@ -77,15 +49,40 @@ applications.</p>
|
|||
.spiffyfg h2 {
|
||||
margin:0px; padding:10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style type="text/css">
|
||||
#left { float:left; }
|
||||
#left h2 { margin:1px; padding-top:0px; }
|
||||
#right { float:left; margin-left:20px; margin-right:20px; padding:0px ;}
|
||||
#right h2 { padding:0px; margin:0px; }
|
||||
#wrappedcontent { padding:15px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="page">
|
||||
<!--#include virtual="menu.html.incl"-->
|
||||
<div id="content">
|
||||
|
||||
|
||||
<table style="margin-top:0px" width="100%" border="0" cellpadding="0px" cellspacing="0">
|
||||
<tr><td>
|
||||
|
||||
<h1>Clang Static Analyzer</h1>
|
||||
|
||||
<p>The Clang Static Analyzer is source code analysis tool that find bugs in C
|
||||
and Objective-C programs.</p>
|
||||
|
||||
<p>Currently it can be run either as a <a href="/scan-build.html">standalone
|
||||
tool</a> or <a href="/xcode.html">within Xcode</a>. The standalone tool is
|
||||
invoked from the command-line, and is intended to be run in tandem with a build
|
||||
of a codebase.</p>
|
||||
|
||||
<p>The analyzer is 100% open source and is part of the <a
|
||||
href="http://clang.llvm.org">Clang</a> project. Like the rest of Clang, the
|
||||
analyzer is implemented as a C++ library that can be used by other tools and
|
||||
applications.</p>
|
||||
|
||||
<h2>Download</h2>
|
||||
|
||||
<div style="padding:0px; font-size: 90%">
|
||||
<b class="spiffy">
|
||||
|
@ -101,7 +98,7 @@ applications.</p>
|
|||
<li>Latest build (Intel-only binary, 10.5+):<br>
|
||||
<!--#include virtual="latest_checker.html.incl"-->
|
||||
</li>
|
||||
<li><a href="/release_notes.html">Release notes</a></li></li>
|
||||
<li><a href="/release_notes.html">Release notes</a></li>
|
||||
<li>This build can be used both from the command line and from within Xcode</li>
|
||||
<li><a href="/installation.html">Installation</a> and <a href="/scan-build.html">usage</a></li>
|
||||
</ul>
|
||||
|
@ -140,10 +137,10 @@ applications.</p>
|
|||
|
||||
|
||||
</td><td style="padding-left:10px">
|
||||
<a href="images/analyzer_xcode.png"><img src="images/analyzer_xcode.png" width="450x" border=0></a>
|
||||
<center><b>Viewing static analyzer results in Xcode 3.2</b></center>
|
||||
<a href="images/analyzer_html.png"><img src="images/analyzer_html.png" width="450px" border=0></a>
|
||||
<center><b>Viewing static analyzer results in a web browser</b></center>
|
||||
<a href="images/analyzer_xcode.png"><img src="images/analyzer_xcode.png" width="450" alt="analyzer in xcode"></a>
|
||||
<div style="text-align:center"><b>Viewing static analyzer results in Xcode 3.2</b></div>
|
||||
<a href="images/analyzer_html.png"><img src="images/analyzer_html.png" width="450" alt="analyzer in browser"></a>
|
||||
<div style="text-align:center"><b>Viewing static analyzer results in a web browser</b></div>
|
||||
</td></tr></table>
|
||||
|
||||
<h2 id="StaticAnalysis">What is Static Analysis?</h2>
|
||||
|
@ -198,7 +195,7 @@ bugs require in the worst case exponential time.</p>
|
|||
|
||||
<p>The Clang Static Analyzer runs in a reasonable amount of time by both
|
||||
bounding the amount of checking work it will do as well as using clever
|
||||
algorithms to reduce the amount of work it must do to find bugs.</p></li>
|
||||
algorithms to reduce the amount of work it must do to find bugs.</p>
|
||||
|
||||
<h3>False Positives</h3>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Obtaining the Static Analyzer</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Release notes for checker-XXX builds</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>scan-build: running the analyzer from the command line</title>
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
<script type="text/javascript" src="scripts/dbtree.js"></script>
|
||||
</head>
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
<h1>scan-build: running the analyzer from the command line</h1>
|
||||
|
||||
<table style="margin-top:0px" width="100%" border="0" cellpadding="0px" cellspacing="0">
|
||||
<table style="margin-top:0px" width="100%" cellpadding="0px" cellspacing="0">
|
||||
<tr><td>
|
||||
|
||||
<h3>What is it?</h3>
|
||||
|
@ -45,11 +45,10 @@ the best use of <b>scan-build</b>, which includes getting it to work when the
|
|||
aforementioned hack fails to work.</p>
|
||||
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<center>
|
||||
<img src="images/scan_build_cmd.png" width="450px" border=0><br>
|
||||
<a href="images/analyzer_html.png"><img src="images/analyzer_html.png" width="450px" border=0></a>
|
||||
<br><b>Viewing static analyzer results in a web browser</b></center>
|
||||
<td style="padding-left:10px; text-align:center">
|
||||
<img src="images/scan_build_cmd.png" width="450px" alt="scan-build"><br>
|
||||
<a href="images/analyzer_html.png"><img src="images/analyzer_html.png" width="450px" alt="analyzer in browser"></a>
|
||||
<br><b>Viewing static analyzer results in a web browser</b>
|
||||
</td></tr></table>
|
||||
|
||||
<h2>Contents</h2>
|
||||
|
@ -101,7 +100,7 @@ $ <span class="code_highlight">scan-build</span> <i>[scan-build options]</i> <sp
|
|||
</pre>
|
||||
|
||||
<p>Operationally, <tt>scan-build</tt> literally runs <command> with all of the
|
||||
subsequent options passed to it. For example, one can pass <nobr><tt>-j4</tt></nobr> to
|
||||
subsequent options passed to it. For example, one can pass <tt>-j4</tt> to
|
||||
<tt>make</tt> get a parallel build over 4 cores:</p>
|
||||
|
||||
<pre class="code_example">
|
||||
|
@ -141,17 +140,17 @@ options prefix the build command. For example:</p>
|
|||
<tr><td><b>-o</b></td><td>Target directory for HTML report files. Subdirectories
|
||||
will be created as needed to represent separate "runs" of the analyzer. If this
|
||||
option is not specified, a directory is created in <tt>/tmp</tt> to store the
|
||||
reports.</td><tr>
|
||||
reports.</td></tr>
|
||||
|
||||
<tr><td><b>-h</b><br><i><nobr>(or no arguments)</nobr></i></td><td>Display all
|
||||
<tr><td><b>-h</b><br><i>(or no arguments)</i></td><td>Display all
|
||||
<tt>scan-build</tt> options.</td></tr>
|
||||
|
||||
<tr><td><b>-k</b><br><nobr><b>--keep-going</b></nobr></td><td>Add a "keep on
|
||||
<tr><td><b>-k</b><br><b>--keep-going</b></td><td>Add a "keep on
|
||||
going" option to the specified build command. <p>This option currently supports
|
||||
<tt>make</tt> and <tt>xcodebuild</tt>.</p> <p>This is a convenience option; one
|
||||
can specify this behavior directly using build options.</p></td></tr>
|
||||
|
||||
<tr><td><b>-v<b></td><td>Verbose output from scan-build and the analyzer. <b>A
|
||||
<tr><td><b>-v</b></td><td>Verbose output from scan-build and the analyzer. <b>A
|
||||
second and third "-v" increases verbosity</b>, and is useful for filing bug
|
||||
reports against the analyzer.</td></tr>
|
||||
|
||||
|
@ -222,7 +221,7 @@ regular compilation and <tt>clang</tt> to perform static analysis.</p>
|
|||
|
||||
<p>Running <tt>configure</tt> typically generates makefiles that have hardwired
|
||||
paths to the compiler, and by running <tt>configure</tt> through
|
||||
<tt>scan-build</tt> that path is set to <tt>ccc-analyzer</tt>.</p.>
|
||||
<tt>scan-build</tt> that path is set to <tt>ccc-analyzer</tt>.</p>
|
||||
|
||||
<!--
|
||||
<h2 id="Debugging">Debugging the Analyzer</h2>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Build and Analyze: running the analyzer within Xcode</title>
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<script type="text/javascript" src="scripts/menu.js"></script>
|
||||
<script type="text/javascript" src="scripts/dbtree.js"></script>
|
||||
</head>
|
||||
|
@ -33,10 +33,9 @@ presents analysis results directly within Xcode's editor.</p>
|
|||
<p><b>Yes</b>. Instructions are included below.</p>
|
||||
|
||||
</td>
|
||||
<td style="padding-left:10px">
|
||||
<center>
|
||||
<a href="images/analyzer_xcode.png"><img src="images/analyzer_xcode.png" width="620px" border=0></a>
|
||||
<br><b>Viewing static analyzer results in Xcode</b></center>
|
||||
<td style="padding-left:10px; text-align:center">
|
||||
<a href="images/analyzer_xcode.png"><img src="images/analyzer_xcode.png" width="620px" alt="analyzer in xcode"></a>
|
||||
<br><b>Viewing static analyzer results in Xcode</b>
|
||||
</td></tr></table>
|
||||
|
||||
<h3>Key features:</h3>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<!-- 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" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>2007 LLVM Developer's Meeting</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
<!--#include virtual="menu.html.incl"-->
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<!-- 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" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>LLVM 2.0 and Beyond!</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
<!--#include virtual="menu.html.incl"-->
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<!-- 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" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Comparing clang to other open source compilers</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
<!--#include virtual="menu.html.incl"-->
|
||||
|
@ -183,6 +183,7 @@
|
|||
inefficient code and does not support many important targets.</li>
|
||||
<li>Like Elsa, PCC's does not have an integrated preprocessor, making it
|
||||
extremely difficult to use it for source analysis tools.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Language Compatibility</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
</style>
|
||||
</head>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<li><a href="#c_variables-class">C variables in @class or @protocol</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#c++">C++ compatibility</a>
|
||||
<li><a href="#cxx">C++ compatibility</a>
|
||||
<ul>
|
||||
<li><a href="#vla">Variable-length arrays</a></li>
|
||||
<li><a href="#dep_lookup">Unqualified lookup in templates</a></li>
|
||||
|
@ -60,13 +60,13 @@
|
|||
<li><a href="#param_name_lookup">Parameter name lookup</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#c++11">C++11 compatibility</a>
|
||||
<li><a href="#cxx11">C++11 compatibility</a>
|
||||
<ul>
|
||||
<li><a href="#deleted-special-func">Deleted special member
|
||||
functions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#objective-c++">Objective-C++ compatibility</a>
|
||||
<li><a href="#objective-cxx">Objective-C++ compatibility</a>
|
||||
<ul>
|
||||
<li><a href="#implicit-downcasts">Implicit downcasts</a></li>
|
||||
</ul>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</ul>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="c">C compatibility</h3>
|
||||
<h2 id="c">C compatibility</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
|
@ -318,7 +318,7 @@ add $4, (%rax)
|
|||
this makes your code more clear and is compatible with both GCC and Clang.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="objective-c">Objective-C compatibility</h3>
|
||||
<h2 id="objective-c">Objective-C compatibility</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
|
@ -409,7 +409,7 @@ extern int c; // allowed
|
|||
</pre>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="c++">C++ compatibility</h3>
|
||||
<h2 id="cxx">C++ compatibility</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
|
@ -761,7 +761,7 @@ void f(int a, int a);
|
|||
<p>Clang diagnoses this error (where the parameter name has been redeclared). To fix this problem, rename one of the parameters.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="c++11">C++11 compatibility</h2>
|
||||
<h2 id="cxx11">C++11 compatibility</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
|
@ -794,7 +794,7 @@ up to version 1.47.0. The fix for Boost's <tt>shared_ptr</tt> is
|
|||
<a href="https://svn.boost.org/trac/boost/changeset/73202">available here</a>.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="objective-c++">Objective-C++ compatibility</h2>
|
||||
<h2 id="objective-cxx">Objective-C++ compatibility</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
|
@ -860,7 +860,7 @@ int cls;
|
|||
@implementation I
|
||||
- (int) Meth { return I.class; }
|
||||
@end
|
||||
<pre>
|
||||
</pre>
|
||||
|
||||
<p>Use explicit message-send syntax instead, i.e. <code>[I class]</code>.</p>
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta HTTP-EQUIV="REFRESH" content="5; url=compatibility.html#c++">
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - C++ Compatibility</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
</style>
|
||||
</head>
|
||||
|
|
|
@ -4,10 +4,14 @@
|
|||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>Clang - Expressive Diagnostics</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
</style>
|
||||
.warn { color:magenta; }
|
||||
.err { color:red; }
|
||||
.snip { color:darkgreen; }
|
||||
.point { color:blue; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -35,14 +39,14 @@ that embed Clang and extract equivalent information through internal APIs.-->
|
|||
|
||||
<p>First, all diagnostics produced by clang include full column number
|
||||
information. The clang command-line compiler driver uses this information
|
||||
to print "caret diagnostics".
|
||||
to print "point diagnostics".
|
||||
(IDEs can use the information to display in-line error markup.)
|
||||
Precise error location in the source is a feature provided by many commercial
|
||||
compilers, but is generally missing from open source
|
||||
compilers. This is nice because it makes it very easy to understand exactly
|
||||
what is wrong in a particular piece of code</p>
|
||||
|
||||
<p>The caret (the blue "^" character) exactly shows where the problem is, even
|
||||
<p>The point (the blue "^" character) exactly shows where the problem is, even
|
||||
inside of a string. This makes it really easy to jump to the problem and
|
||||
helps when multiple instances of the same character occur on a line. (We'll
|
||||
revisit this more in following examples.)</p>
|
||||
|
@ -51,9 +55,9 @@ revisit this more in following examples.)</p>
|
|||
$ <b>gcc-4.2 -fsyntax-only -Wformat format-strings.c</b>
|
||||
format-strings.c:91: warning: too few arguments for format
|
||||
$ <b>clang -fsyntax-only format-strings.c</b>
|
||||
format-strings.c:91:13: <font color="magenta">warning:</font> '.*' specified field precision is missing a matching 'int' argument
|
||||
<font color="darkgreen"> printf("%.*d");</font>
|
||||
<font color="blue"> ^</font>
|
||||
format-strings.c:91:13: <span class="warn">warning:</span> '.*' specified field precision is missing a matching 'int' argument
|
||||
<span class="snip"> printf("%.*d");</span>
|
||||
<span class="point"> ^</span>
|
||||
</pre>
|
||||
|
||||
<h2>Range Highlighting for Related Text</h2>
|
||||
|
@ -63,7 +67,7 @@ statements, and other constructs in your program and uses this to make
|
|||
diagnostics highlight related information. In the following somewhat
|
||||
nonsensical example you can see that you don't even need to see the original source code to
|
||||
understand what is wrong based on the Clang error. Because clang prints a
|
||||
caret, you know exactly <em>which</em> plus it is complaining about. The range
|
||||
point, you know exactly <em>which</em> plus it is complaining about. The range
|
||||
information highlights the left and right side of the plus which makes it
|
||||
immediately obvious what the compiler is talking about.
|
||||
Range information is very useful for
|
||||
|
@ -73,9 +77,9 @@ cases involving precedence issues and many other cases.</p>
|
|||
$ <b>gcc-4.2 -fsyntax-only t.c</b>
|
||||
t.c:7: error: invalid operands to binary + (have 'int' and 'struct A')
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:7:39: <font color="red">error:</font> invalid operands to binary expression ('int' and 'struct A')
|
||||
<font color="darkgreen"> return y + func(y ? ((SomeA.X + 40) + SomeA) / 42 + SomeA.X : SomeA.X);</font>
|
||||
<font color="blue"> ~~~~~~~~~~~~~~ ^ ~~~~~</font>
|
||||
t.c:7:39: <span class="err">error:</span> invalid operands to binary expression ('int' and 'struct A')
|
||||
<span class="snip"> return y + func(y ? ((SomeA.X + 40) + SomeA) / 42 + SomeA.X : SomeA.X);</span>
|
||||
<span class="point"> ~~~~~~~~~~~~~~ ^ ~~~~~</span>
|
||||
</pre>
|
||||
|
||||
<h2>Precision in Wording</h2>
|
||||
|
@ -84,7 +88,7 @@ cases involving precedence issues and many other cases.</p>
|
|||
out of clang contain exactly the pertinent information about what is wrong and
|
||||
why. In the example above, we tell you what the inferred types are for
|
||||
the left and right hand sides, and we don't repeat what is obvious from the
|
||||
caret (e.g., that this is a "binary +").</p>
|
||||
point (e.g., that this is a "binary +").</p>
|
||||
|
||||
<p>Many other examples abound. In the following example, not only do we tell you that there is a problem with the *
|
||||
and point to it, we say exactly why and tell you what the type is (in case it is
|
||||
|
@ -96,9 +100,9 @@ quickly.</p>
|
|||
$ <b>gcc-4.2 -fsyntax-only t.c</b>
|
||||
t.c:5: error: invalid type argument of 'unary *'
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:5:11: <font color="red">error:</font> indirection requires pointer operand ('int' invalid)
|
||||
<font color="darkgreen"> int y = *SomeA.X;</font>
|
||||
<font color="blue"> ^~~~~~~~</font>
|
||||
t.c:5:11: <span class="err">error:</span> indirection requires pointer operand ('int' invalid)
|
||||
<span class="snip"> int y = *SomeA.X;</span>
|
||||
<span class="point"> ^~~~~~~~</span>
|
||||
</pre>
|
||||
|
||||
<h2>No Pretty Printing of Expressions in Diagnostics</h2>
|
||||
|
@ -111,9 +115,9 @@ it tries to do this. In this example P and Q have type "int*":</p>
|
|||
$ <b>gcc-4.2 -fsyntax-only t.c</b>
|
||||
#'exact_div_expr' not supported by pp_c_expression#'t.c:12: error: called object is not a function
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:12:8: <font color="red">error:</font> called object type 'int' is not a function or function pointer
|
||||
<font color="darkgreen"> (P-Q)();</font>
|
||||
<font color="blue"> ~~~~~^</font>
|
||||
t.c:12:8: <span class="err">error:</span> called object type 'int' is not a function or function pointer
|
||||
<span class="snip"> (P-Q)();</span>
|
||||
<span class="point"> ~~~~~^</span>
|
||||
</pre>
|
||||
|
||||
<p>This can be particularly bad in G++, which often emits errors
|
||||
|
@ -136,9 +140,9 @@ it tries to do this. In this example P and Q have type "int*":</p>
|
|||
t.cc:9: error: no match for 'operator+' in '(((a*)P) + (*(long int*)(P->foo::<anonymous>.a::_vptr$a + -0x00000000000000020)))->a::bar() + * P'
|
||||
t.cc:9: error: return-statement with a value, in function returning 'void'
|
||||
$ <b>clang t.cc</b>
|
||||
t.cc:9:18: <font color="red">error:</font> invalid operands to binary expression ('int' and 'foo')
|
||||
<font color="darkgreen"> return P->bar() + *P;</font>
|
||||
<font color="blue"> ~~~~~~~~ ^ ~~</font>
|
||||
t.cc:9:18: <span class="err">error:</span> invalid operands to binary expression ('int' and 'foo')
|
||||
<span class="snip"> return P->bar() + *P;</span>
|
||||
<span class="point"> ~~~~~~~~ ^ ~~</span>
|
||||
</pre>
|
||||
|
||||
|
||||
|
@ -160,9 +164,9 @@ message would be ugly just because it was long and hard to read.</p>
|
|||
$ <b>gcc-4.2 -fsyntax-only t.c</b>
|
||||
t.c:15: error: invalid operands to binary / (have 'float __vector__' and 'const int *')
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:15:11: <font color="red">error:</font> can't convert between vector values of different size ('__m128' and 'int const *')
|
||||
<font color="darkgreen"> myvec[1]/P;</font>
|
||||
<font color="blue"> ~~~~~~~~^~</font>
|
||||
t.c:15:11: <span class="err">error:</span> can't convert between vector values of different size ('__m128' and 'int const *')
|
||||
<span class="snip"> myvec[1]/P;</span>
|
||||
<span class="point"> ~~~~~~~~^~</span>
|
||||
</pre>
|
||||
|
||||
<p>The following example shows where it is useful for the compiler to expose
|
||||
|
@ -173,9 +177,9 @@ system "pid_t" typedef is defined, Clang helpfully displays it with "aka".</p>
|
|||
$ <b>gcc-4.2 -fsyntax-only t.c</b>
|
||||
t.c:13: error: request for member 'x' in something not a structure or union
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:13:9: <font color="red">error:</font> member reference base type 'pid_t' (aka 'int') is not a structure or union
|
||||
<font color="darkgreen"> myvar = myvar.x;</font>
|
||||
<font color="blue"> ~~~~~ ^</font>
|
||||
t.c:13:9: <span class="err">error:</span> member reference base type 'pid_t' (aka 'int') is not a structure or union
|
||||
<span class="snip"> myvar = myvar.x;</span>
|
||||
<span class="point"> ~~~~~ ^</span>
|
||||
</pre>
|
||||
|
||||
<p>In C++, type preservation includes retaining any qualification written into type names. For example, if we take a small snippet of code such as:
|
||||
|
@ -204,9 +208,9 @@ void addHTTPService(servers::Server const &server, ::services::WebService co
|
|||
$ <b>g++-4.2 -fsyntax-only t.cpp</b>
|
||||
t.cpp:9: error: no match for 'operator+=' in 'server += http'
|
||||
$ <b>clang -fsyntax-only t.cpp</b>
|
||||
t.cpp:9:10: <font color="red">error:</font> invalid operands to binary expression ('servers::Server const' and '::services::WebService const *')
|
||||
<font color="darkgreen">server += http;</font>
|
||||
<font color="blue">~~~~~~ ^ ~~~~</font>
|
||||
t.cpp:9:10: <span class="err">error:</span> invalid operands to binary expression ('servers::Server const' and '::services::WebService const *')
|
||||
<span class="snip">server += http;</span>
|
||||
<span class="point">~~~~~~ ^ ~~~~</span>
|
||||
</pre>
|
||||
|
||||
<p>Naturally, type preservation extends to uses of templates, and Clang retains information about how a particular template specialization (like <code>std::vector<Real></code>) was spelled within the source code. For example:</p>
|
||||
|
@ -215,9 +219,9 @@ void addHTTPService(servers::Server const &server, ::services::WebService co
|
|||
$ <b>g++-4.2 -fsyntax-only t.cpp</b>
|
||||
t.cpp:12: error: no match for 'operator=' in 'str = vec'
|
||||
$ <b>clang -fsyntax-only t.cpp</b>
|
||||
t.cpp:12:7: <font color="red">error:</font> incompatible type assigning 'vector<Real>', expected 'std::string' (aka 'class std::basic_string<char>')
|
||||
<font color="darkgreen">str = vec</font>;
|
||||
<font color="blue">^ ~~~</font>
|
||||
t.cpp:12:7: <span class="err">error:</span> incompatible type assigning 'vector<Real>', expected 'std::string' (aka 'class std::basic_string<char>')
|
||||
<span class="snip">str = vec</span>;
|
||||
<span class="point">^ ~~~</span>
|
||||
</pre>
|
||||
|
||||
<h2>Fix-it Hints</h2>
|
||||
|
@ -230,18 +234,18 @@ specific guidance in the form of a code transformation to correct the
|
|||
problem. In the following example, Clang warns about the use of a GCC
|
||||
extension that has been considered obsolete since 1993. The underlined
|
||||
code should be removed, then replaced with the code below the
|
||||
caret line (".x =" or ".y =", respectively).</p>
|
||||
point line (".x =" or ".y =", respectively).</p>
|
||||
|
||||
<pre>
|
||||
$ <b>clang t.c</b>
|
||||
t.c:5:28: <font color="magenta">warning:</font> use of GNU old-style field designator extension
|
||||
<font color="darkgreen">struct point origin = { x: 0.0, y: 0.0 };</font>
|
||||
<font color="red">~~</font> <font color="blue">^</font>
|
||||
<font color="darkgreen">.x = </font>
|
||||
t.c:5:36: <font color="magenta">warning:</font> use of GNU old-style field designator extension
|
||||
<font color="darkgreen">struct point origin = { x: 0.0, y: 0.0 };</font>
|
||||
<font color="red">~~</font> <font color="blue">^</font>
|
||||
<font color="darkgreen">.y = </font>
|
||||
t.c:5:28: <span class="warn">warning:</span> use of GNU old-style field designator extension
|
||||
<span class="snip">struct point origin = { x: 0.0, y: 0.0 };</span>
|
||||
<span class="err">~~</span> <span class="point">^</span>
|
||||
<span class="snip">.x = </span>
|
||||
t.c:5:36: <span class="warn">warning:</span> use of GNU old-style field designator extension
|
||||
<span class="snip">struct point origin = { x: 0.0, y: 0.0 };</span>
|
||||
<span class="err">~~</span> <span class="point">^</span>
|
||||
<span class="snip">.y = </span>
|
||||
</pre>
|
||||
|
||||
<p>"Fix-it" hints are most useful for
|
||||
|
@ -253,10 +257,10 @@ diagnostic.<p>
|
|||
|
||||
<pre>
|
||||
$ <b>clang t.cpp</b>
|
||||
t.cpp:9:3: <font color="red">error:</font> template specialization requires 'template<>'
|
||||
t.cpp:9:3: <span class="err">error:</span> template specialization requires 'template<>'
|
||||
struct iterator_traits<file_iterator> {
|
||||
<font color="blue">^</font>
|
||||
<font color="darkgreen">template<> </font>
|
||||
<span class="point">^</span>
|
||||
<span class="snip">template<> </span>
|
||||
</pre>
|
||||
|
||||
<h2>Automatic Macro Expansion</h2>
|
||||
|
@ -273,12 +277,12 @@ and also shows how some of the other pieces work in a bigger example.</p>
|
|||
t.c: In function 'test':
|
||||
t.c:80: error: invalid operands to binary < (have 'struct mystruct' and 'float')
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:80:3: <font color="red">error:</font> invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
|
||||
<font color="darkgreen"> X = MYMAX(P, F);</font>
|
||||
<font color="blue"> ^~~~~~~~~~~</font>
|
||||
t.c:80:3: <span class="err">error:</span> invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
|
||||
<span class="snip"> X = MYMAX(P, F);</span>
|
||||
<span class="point"> ^~~~~~~~~~~</span>
|
||||
t.c:76:94: note: instantiated from:
|
||||
<font color="darkgreen">#define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })</font>
|
||||
<font color="blue"> ~~~ ^ ~~~</font>
|
||||
<span class="snip">#define MYMAX(A,B) __extension__ ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })</span>
|
||||
<span class="point"> ~~~ ^ ~~~</span>
|
||||
</pre>
|
||||
|
||||
<p>Here's another real world warning that occurs in the "window" Unix package (which
|
||||
|
@ -286,15 +290,15 @@ implements the "wwopen" class of APIs):</p>
|
|||
|
||||
<pre>
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:22:2: <font color="magenta">warning:</font> type specifier missing, defaults to 'int'
|
||||
<font color="darkgreen"> ILPAD();</font>
|
||||
<font color="blue"> ^</font>
|
||||
t.c:22:2: <span class="warn">warning:</span> type specifier missing, defaults to 'int'
|
||||
<span class="snip"> ILPAD();</span>
|
||||
<span class="point"> ^</span>
|
||||
t.c:17:17: note: instantiated from:
|
||||
<font color="darkgreen">#define ILPAD() PAD((NROW - tt.tt_row) * 10) /* 1 ms per char */</font>
|
||||
<font color="blue"> ^</font>
|
||||
<span class="snip">#define ILPAD() PAD((NROW - tt.tt_row) * 10) /* 1 ms per char */</span>
|
||||
<span class="point"> ^</span>
|
||||
t.c:14:2: note: instantiated from:
|
||||
<font color="darkgreen"> register i; \</font>
|
||||
<font color="blue"> ^</font>
|
||||
<span class="snip"> register i; \</span>
|
||||
<span class="point"> ^</span>
|
||||
</pre>
|
||||
|
||||
<p>In practice, we've found that Clang's treatment of macros is actually more useful in multiply nested
|
||||
|
@ -308,7 +312,7 @@ little things add up over time and contribute to a great user experience.</p>
|
|||
<p>The following example shows a trivial little tweak, where we tell you to put the semicolon at
|
||||
the end of the line that is missing it (line 4) instead of at the beginning of
|
||||
the following line (line 5). This is particularly important with fixit hints
|
||||
and caret diagnostics, because otherwise you don't get the important context.
|
||||
and point diagnostics, because otherwise you don't get the important context.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
|
@ -316,10 +320,10 @@ and caret diagnostics, because otherwise you don't get the important context.
|
|||
t.c: In function 'foo':
|
||||
t.c:5: error: expected ';' before '}' token
|
||||
$ <b>clang t.c</b>
|
||||
t.c:4:8: <font color="red">error:</font> expected ';' after expression
|
||||
<font color="darkgreen"> bar()</font>
|
||||
<font color="blue"> ^</font>
|
||||
<font color="blue"> ;</font>
|
||||
t.c:4:8: <span class="err">error:</span> expected ';' after expression
|
||||
<span class="snip"> bar()</span>
|
||||
<span class="point"> ^</span>
|
||||
<span class="point"> ;</span>
|
||||
</pre>
|
||||
|
||||
<p>The following example shows much better error recovery than GCC. The message coming out
|
||||
|
@ -330,9 +334,9 @@ and produces a much more useful diagnosis of the problem.</p>
|
|||
$ <b>gcc-4.2 t.c</b>
|
||||
t.c:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
|
||||
$ <b>clang t.c</b>
|
||||
t.c:3:1: <font color="red">error:</font> unknown type name 'foo_t'
|
||||
<font color="darkgreen">foo_t *P = 0;</font>
|
||||
<font color="blue">^</font>
|
||||
t.c:3:1: <span class="err">error:</span> unknown type name 'foo_t'
|
||||
<span class="snip">foo_t *P = 0;</span>
|
||||
<span class="point">^</span>
|
||||
</pre>
|
||||
|
||||
<p>The following example shows that we recover from the simple case of
|
||||
|
@ -352,14 +356,14 @@ forgetting a ; after a struct definition much better than GCC.</p>
|
|||
t.cc:4: error: invalid type in declaration before ';' token
|
||||
t.cc:6: error: expected unqualified-id at end of input
|
||||
$ <b>clang t.cc</b>
|
||||
t.cc:2:11: <font color="red">error:</font> expected ';' after class
|
||||
<font color="darkgreen">class a {}</font>
|
||||
<font color="blue"> ^</font>
|
||||
<font color="blue"> ;</font>
|
||||
t.cc:6:2: <font color="red">error:</font> expected ';' after struct
|
||||
<font color="darkgreen">}</font>
|
||||
<font color="blue"> ^</font>
|
||||
<font color="blue"> ;</font>
|
||||
t.cc:2:11: <span class="err">error:</span> expected ';' after class
|
||||
<span class="snip">class a {}</span>
|
||||
<span class="point"> ^</span>
|
||||
<span class="point"> ;</span>
|
||||
t.cc:6:2: <span class="err">error:</span> expected ';' after struct
|
||||
<span class="snip">}</span>
|
||||
<span class="point"> ^</span>
|
||||
<span class="point"> ;</span>
|
||||
</pre>
|
||||
|
||||
<p>While each of these details is minor, we feel that they all add up to provide
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Features and Goals</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
</style>
|
||||
</head>
|
||||
|
@ -71,7 +71,8 @@ options for performance analysis.</p>
|
|||
is significantly quicker than gcc and uses less memory For example, when
|
||||
compiling "Carbon.h" on Mac OS/X, we see that clang is 2.5x faster than GCC:</p>
|
||||
|
||||
<img class="img_slide" src="feature-compile1.png" width="400" height="300" />
|
||||
<img class="img_slide" src="feature-compile1.png" width="400" height="300"
|
||||
alt="Time to parse carbon.h: -fsyntax-only">
|
||||
|
||||
<p>Carbon.h is a monster: it transitively includes 558 files, 12.3M of code,
|
||||
declares 10000 functions, has 2000 struct definitions, 8000 fields, 20000 enum
|
||||
|
@ -94,7 +95,8 @@ memory use is even moreso: the less memory the code takes the more code you can
|
|||
fit into memory at a time (useful for whole program analysis tools, for
|
||||
example).</p>
|
||||
|
||||
<img class="img_slide" src="feature-memory1.png" width="400" height="300" />
|
||||
<img class="img_slide" src="feature-memory1.png" width="400" height="300"
|
||||
alt="Space">
|
||||
|
||||
<p>Here we see a huge advantage of clang: its ASTs take <b>5x less memory</b>
|
||||
than GCC's syntax trees, despite the fact that clang's ASTs capture far more
|
||||
|
@ -107,7 +109,8 @@ architecture</a> that makes it relatively easy to adapt it and build new tools
|
|||
with it. This means that it is often possible to apply out-of-the-box thinking
|
||||
and novel techniques to improve compilation in various ways.</p>
|
||||
|
||||
<img class="img_slide" src="feature-compile2.png" width="400" height="300" />
|
||||
<img class="img_slide" src="feature-compile2.png" width="400" height="300"
|
||||
alt="Preprocessor Speeds: GCC 4.2 vs clang-all">
|
||||
|
||||
<p>This slide shows how the clang preprocessor can be used to make "distcc"
|
||||
parallelization <b>3x</b> more scalable than when using the GCC preprocessor.
|
||||
|
@ -149,8 +152,8 @@ GCC and Clang diagnostic:</p>
|
|||
t.c:7: error: invalid operands to binary + (have 'int' and 'struct A')
|
||||
$ <b>clang -fsyntax-only t.c</b>
|
||||
t.c:7:39: error: invalid operands to binary expression ('int' and 'struct A')
|
||||
<font color="darkgreen"> return y + func(y ? ((SomeA.X + 40) + SomeA) / 42 + SomeA.X : SomeA.X);</font>
|
||||
<font color="blue"> ~~~~~~~~~~~~~~ ^ ~~~~~</font>
|
||||
<span style="color:darkgreen"> return y + func(y ? ((SomeA.X + 40) + SomeA) / 42 + SomeA.X : SomeA.X);</span>
|
||||
<span style="color:blue"> ~~~~~~~~~~~~~~ ^ ~~~~~</span>
|
||||
</pre>
|
||||
|
||||
<p>Here you can see that you don't even need to see the original source code to
|
||||
|
@ -200,13 +203,13 @@ and uses. In addition, the library-based approach encourages good interfaces
|
|||
and makes it easier for new developers to get involved (because they only need
|
||||
to understand small pieces of the big picture).</p>
|
||||
|
||||
<blockquote>
|
||||
<blockquote><p>
|
||||
"The world needs better compiler tools, tools which are built as libraries.
|
||||
This design point allows reuse of the tools in new and novel ways. However,
|
||||
building the tools as libraries isn't enough: they must have clean APIs, be as
|
||||
decoupled from each other as possible, and be easy to modify/extend. This
|
||||
requires clean layering, decent design, and keeping the libraries independent of
|
||||
any specific client."</blockquote>
|
||||
any specific client."</p></blockquote>
|
||||
|
||||
<p>
|
||||
Currently, clang is divided into the following libraries and tool:
|
||||
|
@ -295,7 +298,7 @@ hard, and we don't always get it right the first time, but we fix any problems
|
|||
when we realize we made a mistake.</p>
|
||||
|
||||
<!--=======================================================================-->
|
||||
<h3><a name="ideintegration">Integration with IDEs</h3>
|
||||
<h3 id="ideintegration">Integration with IDEs</h3>
|
||||
<!--=======================================================================-->
|
||||
|
||||
<p>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Get Involved</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -56,7 +56,7 @@ discussions or follow the list development on the web if you prefer.</p>
|
|||
|
||||
<p>If you're looking for something to work on, check out our <a href="OpenProjects.html">Open Projects</a> page or go look through the <a href="http://llvm.org/bugs/">Bugzilla bug database</a>.</p>
|
||||
|
||||
<h2 name="criteria">Contributing Extensions to Clang</h2>
|
||||
<h2 id="criteria">Contributing Extensions to Clang</h2>
|
||||
|
||||
<p>Clang has always been designed as a platform for experimentation,
|
||||
allowing programmers to easily extend the compiler to support great
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Getting Started</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -45,23 +45,26 @@ follows:</p>
|
|||
http://www.python.org/download</a></li>
|
||||
</ul>
|
||||
|
||||
<li>Checkout LLVM:</li>
|
||||
<li>Checkout LLVM:
|
||||
<ul>
|
||||
<li>Change directory to where you want the llvm directory placed.</li>
|
||||
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
|
||||
</ul>
|
||||
<li>Checkout Clang:</li>
|
||||
</li>
|
||||
<li>Checkout Clang:
|
||||
<ul>
|
||||
<li><tt>cd llvm/tools</tt>
|
||||
<li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
|
||||
</ul>
|
||||
<li>Checkout Compiler-RT:</li>
|
||||
</li>
|
||||
<li>Checkout Compiler-RT:
|
||||
<ul>
|
||||
<li><tt>cd llvm/projects</tt>
|
||||
<li><tt>svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk
|
||||
compiler-rt</tt></li>
|
||||
</ul>
|
||||
<li>Build LLVM and Clang:</li>
|
||||
</li>
|
||||
<li>Build LLVM and Clang:
|
||||
<ul>
|
||||
<li><tt>cd ../..</tt> (back to where you started)</li>
|
||||
<li><tt>mkdir build</tt> (for building without polluting the source dir)
|
||||
|
@ -72,15 +75,15 @@ follows:</p>
|
|||
<li>This builds both LLVM and Clang for debug mode.</li>
|
||||
<li>Note: For subsequent Clang development, you can just do make at the
|
||||
clang directory level.</li>
|
||||
<li>It is also possible to use CMake instead of the makefiles. With CMake
|
||||
it is also possible to generate project files for several IDEs: Eclipse
|
||||
CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.</li>
|
||||
</ul>
|
||||
|
||||
<p>It is also possible to use CMake instead of the makefiles. With CMake it
|
||||
is also possible to generate project files for several IDEs: Eclipse CDT4,
|
||||
CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.</p>
|
||||
</li>
|
||||
|
||||
<li>If you intend to work on Clang C++ support, you may need to tell it how
|
||||
to find your C++ standard library headers. If Clang cannot find your
|
||||
system libstdc++ headers, please follow these instructions:</li>
|
||||
system libstdc++ headers, please follow these instructions:
|
||||
<ul>
|
||||
<li>'<tt>gcc -v -x c++ /dev/null -fsyntax-only</tt>' to get the
|
||||
path.</li>
|
||||
|
@ -88,7 +91,8 @@ follows:</p>
|
|||
hard-coded paths" in <tt>clang/lib/Frontend/InitHeaderSearch.cpp</tt> and
|
||||
change the lines below to include that path.</li>
|
||||
</ul>
|
||||
<li>Try it out (assuming you add llvm/Debug+Asserts/bin to your path):</li>
|
||||
</li>
|
||||
<li>Try it out (assuming you add llvm/Debug+Asserts/bin to your path):
|
||||
<ul>
|
||||
<li><tt>clang --help</tt></li>
|
||||
<li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>
|
||||
|
@ -96,6 +100,7 @@ follows:</p>
|
|||
<li><tt>clang file.c -S -emit-llvm -o - -O3</tt></li>
|
||||
<li><tt>clang file.c -S -O3 -o -</tt> (output native machine code)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>Note that the C front-end uses LLVM, but does not depend on llvm-gcc. If you
|
||||
|
@ -122,7 +127,7 @@ to subversion. </p>
|
|||
Visual Studio:</p>
|
||||
|
||||
<ol>
|
||||
<li>Get the required tools:</li>
|
||||
<li>Get the required tools:
|
||||
<ul>
|
||||
<li><b>Subversion</b>. Source code control program. Get it from:
|
||||
<a href="http://subversion.tigris.org/getting.html">
|
||||
|
@ -145,17 +150,20 @@ Visual Studio:</p>
|
|||
Get them from <a href="http://getgnuwin32.sourceforge.net/">
|
||||
http://getgnuwin32.sourceforge.net/</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Checkout LLVM:</li>
|
||||
<li>Checkout LLVM:
|
||||
<ul>
|
||||
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
|
||||
</ul>
|
||||
<li>Checkout Clang:</li>
|
||||
</li>
|
||||
<li>Checkout Clang:
|
||||
<ul>
|
||||
<li><tt>cd llvm\tools</tt>
|
||||
<li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
|
||||
</ul>
|
||||
<li>Run cmake to generate the Visual Studio solution and project files:</li>
|
||||
</li>
|
||||
<li>Run cmake to generate the Visual Studio solution and project files:
|
||||
<ul>
|
||||
<li><tt>cd ..\..</tt> (back to where you started)</li>
|
||||
<li><tt>mkdir build</tt> (for building without polluting the source dir)</li>
|
||||
|
@ -168,16 +176,17 @@ Visual Studio:</p>
|
|||
definition in CMakeLists.txt.</li>
|
||||
<li>See the <a href="http://www.llvm.org/docs/CMake.html">LLVM CMake guide</a> for
|
||||
more information on other configuration options for cmake.</li>
|
||||
</li>
|
||||
<li>The above, if successful, will have created an LLVM.sln file in the
|
||||
<tt>build</tt> directory.
|
||||
</ul>
|
||||
<li>Build Clang:</li>
|
||||
</li>
|
||||
<li>Build Clang:
|
||||
<ul>
|
||||
<li>Open LLVM.sln in Visual Studio.</li>
|
||||
<li>Build the "clang" project for just the compiler driver and front end, or
|
||||
the "ALL_BUILD" project to build everything, including tools.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Try it out (assuming you added llvm/debug/bin to your path). (See the
|
||||
running examples from above.)</li>
|
||||
<li>See <a href="hacking.html#testingWindows">
|
||||
|
@ -189,7 +198,7 @@ Visual Studio:</p>
|
|||
to the latest code base, use the <tt>svn update</tt> command in both the
|
||||
llvm and llvm\tools\clang directories, as they are separate repositories.</p>
|
||||
|
||||
<a name="driver"><h2>Clang Compiler Driver (Drop-in Substitute for GCC)</h2></a>
|
||||
<h2 id="driver">Clang Compiler Driver (Drop-in Substitute for GCC)</h2>
|
||||
|
||||
<p>The <tt>clang</tt> tool is the compiler driver and front-end, which is
|
||||
designed to be a drop-in replacement for the <tt>gcc</tt> command. Here are
|
||||
|
@ -248,9 +257,9 @@ $ <b>clang -fsyntax-only ~/t.c</b>
|
|||
|
||||
<pre class="code">
|
||||
$ <b>clang -fsyntax-only ~/t.c -pedantic</b>
|
||||
/Users/sabre/t.c:2:17: <font color="magenta">warning:</font> extension used
|
||||
<font color="darkgreen">typedef float V __attribute__((vector_size(16)));</font>
|
||||
<font color="blue"> ^</font>
|
||||
/Users/sabre/t.c:2:17: <span style="color:magenta">warning:</span> extension used
|
||||
<span style="color:darkgreen">typedef float V __attribute__((vector_size(16)));</span>
|
||||
<span style="color:blue"> ^</span>
|
||||
1 diagnostic generated.
|
||||
</pre>
|
||||
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
<!-- 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" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Hacking on clang</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
pre { margin-left: 1.5em; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!--#include virtual="menu.html.incl"-->
|
||||
|
@ -22,18 +25,19 @@
|
|||
<li><a href="#style">Coding Standards</a></li>
|
||||
<li><a href="#docs">Developer Documentation</a></li>
|
||||
<li><a href="#debugging">Debugging</a></li>
|
||||
<li><a href="#testing">Testing</a></li>
|
||||
<li><a href="#testing">Testing</a>
|
||||
<ul>
|
||||
<li><a href="#testingNonWindows">Testing on Unix-like Systems</a></li>
|
||||
<li><a href="#testingWindows">Testing using Visual Studio on Windows</a></li>
|
||||
<li><a href="#testingCommands">Testing on the Command Line</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#patches">Creating Patch Files</a></li>
|
||||
<li><a href="#irgen">LLVM IR Generation</a></li>
|
||||
</ul>
|
||||
|
||||
<!--=====================================================================-->
|
||||
<h2 id="docs">Coding Standards</h2>
|
||||
<h2 id="style">Coding Standards</h2>
|
||||
<!--=====================================================================-->
|
||||
|
||||
<p>Clang follows the
|
||||
|
@ -139,7 +143,7 @@
|
|||
<p>During the run of <tt>make test</tt>, the terminal output will
|
||||
display a line similar to the following:</p>
|
||||
|
||||
<ul><tt>--- Running clang tests for i686-pc-linux-gnu ---</tt></ul>
|
||||
<pre>--- Running clang tests for i686-pc-linux-gnu ---</pre>
|
||||
|
||||
<p>followed by a line continually overwritten with the current test
|
||||
file being compiled, and an overall completion percentage.</p>
|
||||
|
@ -150,12 +154,12 @@
|
|||
<tt>Failing Tests (count):</tt> message will be followed by a list
|
||||
of the test source file paths that failed. For example:</p>
|
||||
|
||||
<tt><pre>
|
||||
<pre>
|
||||
Failing Tests (3):
|
||||
/home/john/llvm/tools/clang/test/SemaCXX/member-name-lookup.cpp
|
||||
/home/john/llvm/tools/clang/test/SemaCXX/namespace-alias.cpp
|
||||
/home/john/llvm/tools/clang/test/SemaCXX/using-directive.cpp
|
||||
</pre></tt>
|
||||
</pre>
|
||||
|
||||
<p>If you used the <tt>make VERBOSE=1</tt> option, the terminal
|
||||
output will reflect the error messages from the compiler and
|
||||
|
@ -210,10 +214,10 @@
|
|||
<p>To run all the tests from the command line, execute a command like
|
||||
the following:</p>
|
||||
|
||||
<tt>
|
||||
<pre>
|
||||
python (path to llvm)/llvm/utils/lit/lit.py -sv --no-progress-bar
|
||||
(path to llvm)/llvm/tools/clang/test
|
||||
</tt>
|
||||
</pre>
|
||||
|
||||
<p>For CMake builds e.g. on Windows with Visual Studio, you will need
|
||||
to specify your build configuration (Debug, Release, etc.) via
|
||||
|
@ -221,31 +225,31 @@
|
|||
|
||||
<p>To run a single test:</p>
|
||||
|
||||
<tt>
|
||||
<pre>
|
||||
python (path to llvm)/llvm/utils/lit/lit.py -sv --no-progress-bar
|
||||
(path to llvm)/llvm/tools/clang/test/(dir)/(test)
|
||||
</tt>
|
||||
</pre>
|
||||
|
||||
<p>For example:</p>
|
||||
|
||||
<tt>
|
||||
<pre>
|
||||
python C:/Tools/llvm/utils/lit/lit.py -sv --no-progress-bar
|
||||
C:/Tools/llvm/tools/clang/test/Sema/wchar.c
|
||||
</tt>
|
||||
</pre>
|
||||
|
||||
<p>The -sv option above tells the runner to show the test output if
|
||||
any tests failed, to help you determine the cause of failure.</p>
|
||||
|
||||
<p>Your output might look something like this:</p>
|
||||
|
||||
<tt><pre>lit.py: lit.cfg:152: note: using clang: 'C:/Tools/llvm/bin/Release\\clang.EXE'
|
||||
<pre>lit.py: lit.cfg:152: note: using clang: 'C:/Tools/llvm/bin/Release\\clang.EXE'
|
||||
-- Testing: Testing: 2534 tests, 4 threads --
|
||||
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
|
||||
Testing Time: 81.52s
|
||||
Expected Passes : 2503
|
||||
Expected Failures : 28
|
||||
Unsupported Tests : 3
|
||||
</pre></tt>
|
||||
</pre>
|
||||
|
||||
<p>The statistic, "Unexpected Failures" (not shown if all tests pass), is the important one.</p>
|
||||
|
||||
|
@ -263,15 +267,15 @@ Testing Time: 81.52s
|
|||
<p>To create these patch files, change directory
|
||||
to the llvm/tools/clang root and run:</p>
|
||||
|
||||
<ul><tt>svn diff (relative path) >(patch file name)</tt></ul>
|
||||
<pre>svn diff (relative path) >(patch file name)</pre>
|
||||
|
||||
<p>For example, for getting the diffs of all of clang:</p>
|
||||
|
||||
<ul><tt>svn diff . >~/mypatchfile.patch</tt></ul>
|
||||
<pre>svn diff . >~/mypatchfile.patch</pre>
|
||||
|
||||
<p>For example, for getting the diffs of a single file:</p>
|
||||
|
||||
<ul><tt>svn diff lib/Parse/ParseDeclCXX.cpp >~/ParseDeclCXX.patch</tt></ul>
|
||||
<pre>svn diff lib/Parse/ParseDeclCXX.cpp >~/ParseDeclCXX.patch</pre>
|
||||
|
||||
<p>Note that the paths embedded in the patch depend on where you run it,
|
||||
so changing directory to the llvm/tools/clang directory is recommended.</p>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Performance</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
</style>
|
||||
</head>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<!--*************************************************************************-->
|
||||
|
||||
<p>This page tracks the compile time performance of Clang on two
|
||||
interesting benchmarks:
|
||||
interesting benchmarks:</p>
|
||||
<ul>
|
||||
<li><i>Sketch</i>: The Objective-C example application shipped on
|
||||
Mac OS X as part of Xcode. <i>Sketch</i> is indicative of a
|
||||
|
@ -37,7 +37,6 @@ interesting benchmarks:
|
|||
dependencies. This stresses the back-end's performance on generating
|
||||
assembly code and debug information.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<!--*************************************************************************-->
|
||||
<h2><a name="enduser">Experiments</a></h2>
|
||||
|
@ -46,7 +45,7 @@ interesting benchmarks:
|
|||
<p>Measurements are done by serially processing each file in the
|
||||
respective benchmark, using Clang, gcc, and llvm-gcc as compilers. In
|
||||
order to track the performance of various subsystems the timings have
|
||||
been broken down into separate stages where possible:
|
||||
been broken down into separate stages where possible:</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>-Eonly</tt>: This option runs the preprocessor but does not
|
||||
|
@ -65,7 +64,6 @@ been broken down into separate stages where possible:
|
|||
<li><tt>-S -O0 -g</tt>: This adds emission of debug information to
|
||||
the assembly output.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>This set of stages is chosen to be approximately additive, that is
|
||||
each subsequent stage simply adds some additional processing. The
|
||||
|
@ -94,9 +92,9 @@ compile time here.</p>
|
|||
<h3><a name="2008-10-31">2008-10-31</a></h3>
|
||||
<!--=======================================================================-->
|
||||
|
||||
<center><h4>Sketch</h4></center>
|
||||
<h4 style="text-align:center">Sketch</h4>
|
||||
<img class="img_slide"
|
||||
src="timing-data/2008-10-31/sketch.png" alt="Sketch Timings"/>
|
||||
src="timing-data/2008-10-31/sketch.png" alt="Sketch Timings">
|
||||
|
||||
<p>This shows Clang's substantial performance improvements in
|
||||
preprocessing and semantic analysis; over 90% faster on
|
||||
|
@ -112,9 +110,9 @@ with PCH; about 4x in wall time. Unfortunately, Clang does not yet
|
|||
have an implementation of PCH-style optimizations, but we are actively
|
||||
working to address this.</p>
|
||||
|
||||
<center><h4>176.gcc</h4></center>
|
||||
<h4 style="text-align:center">176.gcc</h4>
|
||||
<img class="img_slide"
|
||||
src="timing-data/2008-10-31/176.gcc.png" alt="176.gcc Timings"/>
|
||||
src="timing-data/2008-10-31/176.gcc.png" alt="176.gcc Timings">
|
||||
|
||||
<p>Unlike the <i>Sketch</i> timings, compilation of <i>176.gcc</i>
|
||||
involves a large amount of code generation. The time spent in Clang's
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Performance</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
</style>
|
||||
</head>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<!--*************************************************************************-->
|
||||
|
||||
<p>This page shows the compile time performance of Clang on two
|
||||
interesting benchmarks:
|
||||
interesting benchmarks:</p>
|
||||
<ul>
|
||||
<li><i>Sketch</i>: The Objective-C example application shipped on
|
||||
Mac OS X as part of Xcode. <i>Sketch</i> is indicative of a
|
||||
|
@ -37,7 +37,6 @@ interesting benchmarks:
|
|||
dependencies. This stresses the back-end's performance on generating
|
||||
assembly code and debug information.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For previous performance numbers, please
|
||||
|
@ -57,7 +56,7 @@ in order to evaluate the overhead of the driver itself.</p>
|
|||
have been broken down into separate stages where possible. This is
|
||||
done by over-riding the CC environment variable used during the build
|
||||
to point to one of a few simple shell scripts which may skip part of
|
||||
the build.
|
||||
the build.</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>non-compiler</tt>: The overhead of the build system itself;
|
||||
|
@ -78,7 +77,6 @@ the build.
|
|||
<li><tt>+ assembler</tt>: Add assembler time to generate .o files.</li>
|
||||
<li><tt>+ linker</tt>: Add linker time.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>This set of stages is chosen to be approximately additive, that is
|
||||
each subsequent stage simply adds some additional processing. The
|
||||
|
@ -99,12 +97,12 @@ analysis (and preprocessing/parsing, in the case of gcc).</p>
|
|||
|
||||
<a href="timing-data/2009-03-02/sketch.pdf">
|
||||
<img class="img_slide"
|
||||
src="timing-data/2009-03-02/sketch.png" alt="Sketch Timings"/>
|
||||
src="timing-data/2009-03-02/sketch.png" alt="Sketch Timings">
|
||||
</a>
|
||||
|
||||
<a href="timing-data/2009-03-02/176.gcc.pdf">
|
||||
<img class="img_slide"
|
||||
src="timing-data/2009-03-02/176.gcc.png" alt="176.gcc Timings"/>
|
||||
src="timing-data/2009-03-02/176.gcc.png" alt="176.gcc Timings">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang - Performance</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
<style type="text/css">
|
||||
</style>
|
||||
</head>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<!--*************************************************************************-->
|
||||
|
||||
<p>This page shows the compile time performance of Clang on two
|
||||
interesting benchmarks:
|
||||
interesting benchmarks:</p>
|
||||
<ul>
|
||||
<li><i>Sketch</i>: The Objective-C example application shipped on
|
||||
Mac OS X as part of Xcode. <i>Sketch</i> is indicative of a
|
||||
|
@ -37,7 +37,6 @@ interesting benchmarks:
|
|||
dependencies. This stresses the back-end's performance on generating
|
||||
assembly code and debug information.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For previous performance numbers, please
|
||||
|
@ -56,7 +55,7 @@ compilers.</p>
|
|||
have been broken down into separate stages where possible. This is
|
||||
done by over-riding the CC environment variable used during the build
|
||||
to point to one of a few simple shell scripts which may skip part of
|
||||
the build.
|
||||
the build.</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>non-compiler</tt>: The overhead of the build system itself;
|
||||
|
@ -73,7 +72,6 @@ the build.
|
|||
<li><tt>+ assembler</tt>: Add assembler time to generate .o files.</li>
|
||||
<li><tt>+ linker</tt>: Add linker time.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>This set of stages is chosen to be approximately additive, that is each
|
||||
subsequent stage simply adds some additional processing. The timings measure the
|
||||
|
@ -93,12 +91,12 @@ semantic analysis after PCH generation is done.</p>
|
|||
|
||||
<a href="timing-data/2009-06-26/sketch.pdf">
|
||||
<img class="img_slide"
|
||||
src="timing-data/2009-06-26/sketch.png" alt="Sketch Timings"/>
|
||||
src="timing-data/2009-06-26/sketch.png" alt="Sketch Timings">
|
||||
</a>
|
||||
|
||||
<a href="timing-data/2009-06-26/176.gcc.pdf">
|
||||
<img class="img_slide"
|
||||
src="timing-data/2009-06-26/176.gcc.png" alt="176.gcc Timings"/>
|
||||
src="timing-data/2009-06-26/176.gcc.png" alt="176.gcc Timings">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<!-- 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" />
|
||||
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Clang Related Projects</title>
|
||||
<link type="text/css" rel="stylesheet" href="menu.css" />
|
||||
<link type="text/css" rel="stylesheet" href="content.css" />
|
||||
<link type="text/css" rel="stylesheet" href="menu.css">
|
||||
<link type="text/css" rel="stylesheet" href="content.css">
|
||||
</head>
|
||||
<body>
|
||||
<!--#include virtual="menu.html.incl"-->
|
||||
|
|
Loading…
Reference in New Issue