[llvm] r339455 - Update the coding standards and developer policy documentation surrounding whitespace.

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 10 10:26:07 PDT 2018


Author: aaronballman
Date: Fri Aug 10 10:26:07 2018
New Revision: 339455

URL: http://llvm.org/viewvc/llvm-project?rev=339455&view=rev
Log:
Update the coding standards and developer policy documentation surrounding whitespace.

Clarify that you should not introduce trailing whitespace when making a commit and that you should not remove trailing whitespace that's unrelated to code you are changing or are about to change. Then clarified the developer policy around what is considered an obvious whitespace commit.

Modified:
    llvm/trunk/docs/CodingStandards.rst
    llvm/trunk/docs/DeveloperPolicy.rst
    llvm/trunk/docs/Lexicon.rst

Modified: llvm/trunk/docs/CodingStandards.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.rst?rev=339455&r1=339454&r2=339455&view=diff
==============================================================================
--- llvm/trunk/docs/CodingStandards.rst (original)
+++ llvm/trunk/docs/CodingStandards.rst Fri Aug 10 10:26:07 2018
@@ -494,8 +494,8 @@ for it (vs something else, like 90 colum
 This is one of many contentious issues in coding standards, but it is not up for
 debate.
 
-Use Spaces Instead of Tabs
-^^^^^^^^^^^^^^^^^^^^^^^^^^
+Whitespace
+^^^^^^^^^^
 
 In all cases, prefer spaces to tabs in source files.  People have different
 preferred indentation levels, and different styles of indentation that they
@@ -509,6 +509,12 @@ indentation, **DO NOT** do that in the m
 of indentation.  Also, do not reindent a whole source file: it makes for
 incredible diffs that are absolutely worthless.
 
+Do not commit changes that include trailing whitespace. If you find trailing
+whitespace in a file, do not remove it unless you're otherwise changing that
+line of code. Some common editors will automatically remove trailing whitespace
+when saving a file which causes unrelated changes to appear in diffs and
+commits.
+
 Indent Code Consistently
 ^^^^^^^^^^^^^^^^^^^^^^^^
 

Modified: llvm/trunk/docs/DeveloperPolicy.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.rst?rev=339455&r1=339454&r2=339455&view=diff
==============================================================================
--- llvm/trunk/docs/DeveloperPolicy.rst (original)
+++ llvm/trunk/docs/DeveloperPolicy.rst Fri Aug 10 10:26:07 2018
@@ -376,7 +376,13 @@ If you have recently been granted commit
    obvious. This is clearly a subjective decision --- we simply expect you to
    use good judgement.  Examples include: fixing build breakage, reverting
    obviously broken patches, documentation/comment changes, any other minor
-   changes.
+   changes. Avoid committing formatting- or whitespace-only changes outside of
+   code you plan to make subsequent changes to. Also, try to separate
+   formatting or whitespace changes from functional changes, either by
+   correcting the format first (ideally) or afterward. Such changes should be
+   highly localized and the commit message should clearly state that the commit
+   is not intended to change functionality, usually by stating it is
+   :ref:`NFC <nfc>`.
 
 #. You are allowed to commit patches without approval to those portions of LLVM
    that you have contributed or maintain (i.e., have been assigned

Modified: llvm/trunk/docs/Lexicon.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Lexicon.rst?rev=339455&r1=339454&r2=339455&view=diff
==============================================================================
--- llvm/trunk/docs/Lexicon.rst (original)
+++ llvm/trunk/docs/Lexicon.rst Fri Aug 10 10:26:07 2018
@@ -185,6 +185,7 @@ M
 
 N
 -
+.. _nfc:
 
 **NFC**
   "No functional change". Used in a commit message to indicate that a patch




More information about the llvm-commits mailing list