diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-03-21 01:45:18 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-03-21 01:45:18 +0000 |
commit | 38448d3ae8dbea95ba7d6852169dd00874bf7be9 (patch) | |
tree | c45f16224026bee191091c8215a14407e4b76ade | |
parent | 80558d2db10a96eada4d8fb79949b3263b44652b (diff) |
Code modification hints have been known as fix-it hints for almost
a year now. Update the internals manual.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127983 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | docs/InternalsManual.html | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/docs/InternalsManual.html b/docs/InternalsManual.html index 6956a118b1..961198938f 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> |