Coding Style

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Coding Style

Nathan Ridge via cfe-dev
Hi all,

What is the coding style that clang developers (https://github.com/llvm-mirror/clang) use? When I use ".clang-format" to reformat the code that is in this repo, cpp files change. Is there any other clang-format config that is used in this repo?

Best,
Pardis

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Coding Style

Nathan Ridge via cfe-dev
On Tue, Jun 25, 2019 at 11:12 PM Pardis Pashakhanloo via cfe-dev <[hidden email]> wrote:
Hi all,

What is the coding style that clang developers (https://github.com/llvm-mirror/clang) use? When I use ".clang-format" to reformat the code that is in this repo, cpp files change. Is there any other clang-format config that is used in this repo?
That the code does not change when `clang-format` is applied using the LLVM style (`--style=llvm`) is not an actual requirement the last I checked. Put another way, `clang-format` output is not the only valid expression of the LLVM style. Instead of applying `clang-format` to the entire file, try using `clang/tools/clang-format/git-clang-format`.
 

Best,
Pardis
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Coding Style

Nathan Ridge via cfe-dev

To put it yet another way:

We want new/modified code to conform to the style enforced by clang-format.  We have not applied that format to all existing code.  LLVM's coding style has evolved over the years, and the general feeling within the project is that a mass conversion from old to new style would be too disruptive.  So, you will find a mix of styles within the project, although it's not too common to find a mix of styles within the same file.

For patches you might be writing, there are a couple of useful scripts in clang/tools/clang-format, which are clang-format-diff.py and git-clang-format.

--paulr

 

From: cfe-dev [mailto:[hidden email]] On Behalf Of Hubert Tong via cfe-dev
Sent: Tuesday, June 25, 2019 11:34 PM
To: Pardis Pashakhanloo
Cc: Clang Dev
Subject: Re: [cfe-dev] Coding Style

 

On Tue, Jun 25, 2019 at 11:12 PM Pardis Pashakhanloo via cfe-dev <[hidden email]> wrote:

Hi all,

 

What is the coding style that clang developers (https://github.com/llvm-mirror/clang) use? When I use ".clang-format" to reformat the code that is in this repo, cpp files change. Is there any other clang-format config that is used in this repo?

That the code does not change when `clang-format` is applied using the LLVM style (`--style=llvm`) is not an actual requirement the last I checked. Put another way, `clang-format` output is not the only valid expression of the LLVM style. Instead of applying `clang-format` to the entire file, try using `clang/tools/clang-format/git-clang-format`.

 

 

Best,

Pardis

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev