mchalupa / dg

[LLVM Static Slicer] Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode.
MIT License
474 stars 131 forks source link

Add `.clang-format` #386

Closed lzaoral closed 3 years ago

lzaoral commented 3 years ago

This PR adds a (relatively) reasonable configuration for clang-format that should mimic the style used the most in dg. Only one thing that doesn't seem to be quite consistent are line-breaks before braces, e.g:

int foo()        vs.        int foo() {
{                           ....
....                        } 
}

If there is some option that you dislike or would like to see changed, please tell me.

EDIT: typo

mchalupa commented 3 years ago

Yep, in the former code, the line breaks were different than in the current, so it is inconsistent. I quite like the clang-format config you did. Just one thing I do not like that much is to have the & for references at type instead of at the variable. That is, type &var instead of type& var. However, we write pointers also as type *ptr (where I also think that type* ptr would be better as * is connected to type, but the habit is strong), so I will probably re-think this for the sake of consistency.

mchalupa commented 3 years ago

Yep, let's go with this, thanks!