Skip to content
Snippets Groups Projects
  • Krasimir Georgiev's avatar
    17abd01e
    [clang-format] Fix regression about not aligning trailing comments in case... · 17abd01e
    Krasimir Georgiev authored
    [clang-format] Fix regression about not aligning trailing comments in case they were previously aligned, but at different indent.
    
    Summary:
    Comment reflower was adding untouchable tokens in case two consecutive comment lines are aligned in the source code. This disallows the whitespace manager to re-indent them later.
    
    source:
    ```
    int i = f(abc, // line 1
              d, // line 2
    	     // line 3
    	  b);
    ```
    Since line 2 and line 3 are aligned, the reflower was marking line 3 as untouchable; however the three comment lines need to be re-aligned.
    output before:
    ```
    int i = f(abc, // line 1
              d,   // line 2
    	     // line 3
    	  b);
    ```
    output after:
    ```
    int i = f(abc, // line 1
              d,   // line 2
    	       // line 3
    	  b);
    ```
    
    Reviewers: djasper
    
    Reviewed By: djasper
    
    Subscribers: sammccall, cfe-commits, klimek
    
    Differential Revision: https://reviews.llvm.org/D29383
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293755 91177308-0d34-0410-b5e6-96231b3b80d8
    17abd01e
    History
    [clang-format] Fix regression about not aligning trailing comments in case...
    Krasimir Georgiev authored
    [clang-format] Fix regression about not aligning trailing comments in case they were previously aligned, but at different indent.
    
    Summary:
    Comment reflower was adding untouchable tokens in case two consecutive comment lines are aligned in the source code. This disallows the whitespace manager to re-indent them later.
    
    source:
    ```
    int i = f(abc, // line 1
              d, // line 2
    	     // line 3
    	  b);
    ```
    Since line 2 and line 3 are aligned, the reflower was marking line 3 as untouchable; however the three comment lines need to be re-aligned.
    output before:
    ```
    int i = f(abc, // line 1
              d,   // line 2
    	     // line 3
    	  b);
    ```
    output after:
    ```
    int i = f(abc, // line 1
              d,   // line 2
    	       // line 3
    	  b);
    ```
    
    Reviewers: djasper
    
    Reviewed By: djasper
    
    Subscribers: sammccall, cfe-commits, klimek
    
    Differential Revision: https://reviews.llvm.org/D29383
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293755 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.