diff options
Diffstat (limited to 'docs/InternalsManual.html')
-rw-r--r-- | docs/InternalsManual.html | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/docs/InternalsManual.html b/docs/InternalsManual.html index 813015e..9611989 100644 --- a/docs/InternalsManual.html +++ b/docs/InternalsManual.html @@ -412,7 +412,7 @@ it is rendered. </p> <!-- ==================================================== --> -<h4 id="code-modification-hints">Code Modification Hints</h4> +<h4 id="fix-it-hints">Fix-It Hints</h4> <!-- ==================================================== --> <p>In some cases, the front end emits diagnostics when it is clear @@ -422,14 +422,14 @@ deprecated syntax that is easily rewritten into a more modern form. Clang tries very hard to emit the diagnostic and recover gracefully in these and other cases.</p> -<p>However, for these cases where the fix is obvious, the diagnostic -can be annotated with a code -modification "hint" that describes how to change the code referenced -by the diagnostic to fix the problem. For example, it might add the -missing semicolon at the end of the statement or rewrite the use of a -deprecated construct into something more palatable. Here is one such -example C++ front end, where we warn about the right-shift operator -changing meaning from C++98 to C++0x:</p> +<p>However, for these cases where the fix is obvious, the diagnostic +can be annotated with a hint (referred to as a "fix-it hint") that +describes how to change the code referenced by the diagnostic to fix +the problem. For example, it might add the missing semicolon at the +end of the statement or rewrite the use of a deprecated construct +into something more palatable. Here is one such example from the C++ +front end, where we warn about the right-shift operator changing +meaning from C++98 to C++0x:</p> <pre> test.cpp:3:7: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++0x @@ -438,33 +438,31 @@ A<100 >> 2> *a; ( ) </pre> -<p>Here, the code modification hint is suggesting that parentheses be -added, and showing exactly where those parentheses would be inserted -into the source code. The code modification hints themselves describe -what changes to make to the source code in an abstract manner, which -the text diagnostic printer renders as a line of "insertions" below -the caret line. <a href="#DiagnosticClient">Other diagnostic -clients</a> might choose to render the code differently (e.g., as -markup inline) or even give the user the ability to automatically fix -the problem.</p> - -<p>All code modification hints are described by the -<code>CodeModificationHint</code> class, instances of which should be -attached to the diagnostic using the << operator in the same way -that highlighted source ranges and arguments are passed to the -diagnostic. Code modification hints can be created with one of three -constructors:</p> +<p>Here, the fix-it hint is suggesting that parentheses be added, +and showing exactly where those parentheses would be inserted into the +source code. The fix-it hints themselves describe what changes to make +to the source code in an abstract manner, which the text diagnostic +printer renders as a line of "insertions" below the caret line. <a +href="#DiagnosticClient">Other diagnostic clients</a> might choose +to render the code differently (e.g., as markup inline) or even give +the user the ability to automatically fix the problem.</p> + +<p>All fix-it hints are described by the <code>FixItHint</code> class, +instances of which should be attached to the diagnostic using the +<< operator in the same way that highlighted source ranges and +arguments are passed to the diagnostic. Fix-it hints can be created +with one of three constructors:</p> <dl> - <dt><code>CodeModificationHint::CreateInsertion(Loc, Code)</code></dt> + <dt><code>FixItHint::CreateInsertion(Loc, Code)</code></dt> <dd>Specifies that the given <code>Code</code> (a string) should be inserted before the source location <code>Loc</code>.</dd> - <dt><code>CodeModificationHint::CreateRemoval(Range)</code></dt> + <dt><code>FixItHint::CreateRemoval(Range)</code></dt> <dd>Specifies that the code in the given source <code>Range</code> should be removed.</dd> - <dt><code>CodeModificationHint::CreateReplacement(Range, Code)</code></dt> + <dt><code>FixItHint::CreateReplacement(Range, Code)</code></dt> <dd>Specifies that the code in the given source <code>Range</code> should be removed, and replaced with the given <code>Code</code> string.</dd> </dl> @@ -821,7 +819,7 @@ code is vectorized on X86 and PowerPC hosts).</p> within the filename.</li> <li>When parsing a preprocessor directive (after "<tt>#</tt>") the ParsingPreprocessorDirective mode is entered. This changes the parser to - return EOM at a newline.</li> + return EOD at a newline.</li> <li>The Lexer uses a LangOptions object to know whether trigraphs are enabled, whether C++ or ObjC keywords are recognized, etc.</li> </ul> |