[PATCH] D62470: Clarify when fix-it hints on warnings are appropriate

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 26 14:37:32 PDT 2019


aaronpuchert created this revision.
aaronpuchert added reviewers: rsmith, aaron.ballman.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is not a change in the rules, it's meant as a clarification about
warnings. Since the recovery from warnings is a no-op, the fix-it hints
on warnings shouldn't change anything. Anything that doesn't just
suppress the warning and changes the meaning of the code (even if it's
for the better) should be on an additional note.


Repository:
  rC Clang

https://reviews.llvm.org/D62470

Files:
  docs/InternalsManual.rst


Index: docs/InternalsManual.rst
===================================================================
--- docs/InternalsManual.rst
+++ docs/InternalsManual.rst
@@ -423,6 +423,9 @@
   driver, they should only be used when it's very likely they match the user's
   intent.
 * Clang must recover from errors as if the fix-it had been applied.
+* Fix-it hints on a warning should only clarify the meaning of the existing
+  code, not change it. Examples for such hints are added parentheses in cases
+  of counter-intuitive precedence, when they clarify the order of operations.
 
 If a fix-it can't obey these rules, put the fix-it on a note.  Fix-its on notes
 are not applied automatically.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62470.201469.patch
Type: text/x-patch
Size: 688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190526/ced7f075/attachment.bin>


More information about the cfe-commits mailing list