r362266 - Clarify when fix-it hints on warnings are appropriate

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Fri May 31 14:27:40 PDT 2019


Author: aaronpuchert
Date: Fri May 31 14:27:39 2019
New Revision: 362266

URL: http://llvm.org/viewvc/llvm-project?rev=362266&view=rev
Log:
Clarify when fix-it hints on warnings are appropriate

Summary:
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.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits, thakis

Tags: #clang

Differential Revision: https://reviews.llvm.org/D62470

Modified:
    cfe/trunk/docs/InternalsManual.rst

Modified: cfe/trunk/docs/InternalsManual.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/InternalsManual.rst?rev=362266&r1=362265&r2=362266&view=diff
==============================================================================
--- cfe/trunk/docs/InternalsManual.rst (original)
+++ cfe/trunk/docs/InternalsManual.rst Fri May 31 14:27:39 2019
@@ -423,6 +423,9 @@ Fix-it hints on errors and warnings need
   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 must not change the meaning of the code.
+  However, a hint may clarify the meaning as intentional, for example by adding
+  parentheses when the precedence of operators isn't obvious.
 
 If a fix-it can't obey these rules, put the fix-it on a note.  Fix-its on notes
 are not applied automatically.




More information about the cfe-commits mailing list