forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-reorder-fields] Move trailing comments. (llvm#122918)
Currently, trailing comments get mixed up: ``` struct Foo { int a; // This one is the cool field // within the struct. int b; }; ``` becomes: ``` struct Foo { int b; // This one is the cool field // within the struct. int a; }; ``` This should be: ``` struct Foo { int b; int a; // This one is the cool field // within the struct. }; ```
- Loading branch information
1 parent
c8bbbaa
commit 6affc18
Showing
2 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// RUN: clang-reorder-fields -record-name Foo -fields-order e1,e3,e2,a,c,b %s -- | FileCheck %s | ||
|
||
class Foo { | ||
int a; // Trailing comment for a. | ||
int b; // Multiline | ||
// trailing for b. | ||
// Prefix comments for c. | ||
int c; | ||
|
||
/*c-like*/ int e1; | ||
int /*c-like*/ e2; | ||
int e3 /*c-like*/; | ||
}; | ||
|
||
// CHECK: /*c-like*/ int e1; | ||
// CHECK-NEXT: int e3 /*c-like*/; | ||
// CHECK-NEXT: int /*c-like*/ e2; | ||
// CHECK-NEXT: int a; // Trailing comment for a. | ||
// CHECK-NEXT: // Prefix comments for c. | ||
// CHECK-NEXT: int c; | ||
// CHECK-NEXT: int b; // Multiline | ||
// CHECK-NEXT: // trailing for b. | ||
|