llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.14k stars 12.02k forks source link

[clang-format] - [Feature Request] - Sort Forward Declarations #107770

Open CausticDream opened 2 months ago

CausticDream commented 2 months ago

It looks like sort of forward declarations is a feature missing for clang-format.

mydeveloperday commented 1 month ago

Can you give good examples of what you are seeing and what you expect to see

CausticDream commented 1 month ago

The expected result is to sort the forward declaration by group. Here an example of Test.h and then Test.h after the sorting.

Test.h:

class ForwardDecl1;
class ForwardDecl0;

namespace Test
{
    class ForwardDecl3;
    class ForwardDecl2;
}

Test.h (after sorting):

class ForwardDecl0;
class ForwardDecl1;

namespace Test
{
    class ForwardDecl2;
    class ForwardDecl3;
}
JanFellner commented 2 weeks ago

Like this idea so i´m jumping in and voting for that idea :)