summaryrefslogtreecommitdiffstats
path: root/www/diagnostics.html
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-01 16:24:40 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-01 16:24:40 +0000
commiteff49c675c3b02b5acf952a64a6e7e26e99e61e7 (patch)
tree0f52dc706335677035c743716fe18582c6e53301 /www/diagnostics.html
parente9b7d8ace8674585818990cff585daae7745bd88 (diff)
Add some examples of Fix-it hints to our documentation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www/diagnostics.html')
-rw-r--r--www/diagnostics.html31
1 files changed, 30 insertions, 1 deletions
diff --git a/www/diagnostics.html b/www/diagnostics.html
index 4f68f58d52..5be4db2074 100644
--- a/www/diagnostics.html
+++ b/www/diagnostics.html
@@ -200,8 +200,37 @@ void addHTTPService(servers::Server const &server, ::services::WebService const
<h2>Fix-it Hints</h2>
-<p>simple example + template&lt;&gt; example</p>
+<p>"Fix-it" hints provide advice for fixing small, localized problems
+in source code. When Clang produces a diagnostic about a particular
+problem that it can work around (e.g., non-standard or redundant
+syntax, missing keywords, common mistakes, etc.), it may also provide
+specific guidance in the form of a code transformation to correct the
+problem. For example, here Clang warns about the use of a GCC
+extension that has been considered obsolete since 1993:</p>
+<pre>
+ $ <b>clang t.c</b>
+ t.c:5:28: warning: 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: warning: 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>
+</pre>
+
+<p>The underlined code should be removed, then replaced with the code below the caret line (".x =" or ".y =", respectively). "Fix-it" hints are most useful for working around common user errors and misconceptions. For example, C++ users commonly forget the syntax for explicit specialization of class templates, as in the following error:</p>
+
+<pre>
+ $ <b>clang t.cpp</b>
+ t.cpp:9:3: error: template specialization requires 'template&lt;&gt;'
+ struct iterator_traits&lt;file_iterator&gt; {
+ <font color="blue">^</font>
+ <font color="darkgreen">template&lt;&gt; </font>
+</pre>
+
+<p>Again, after describing the problem, Clang provides the fix--add <code>template&lt;&gt;</code>--as part of the diagnostic.<p>
<h2>Automatic Macro Expansion</h2>