Issue 117477
Summary [clang-format] Linebreaks and indentation change when updating from v18.1.8 -> v19.1.5
Labels clang-format
Assignees
Reporter RainerKuemmerle
    I noticed that in my code, clang-format v19.1.3 behaves very different with the same settings.

An excerpt from the formatting changes.

v18.1.8
```cpp
namespace g2o {

class G2O_STUFF_API Sampler {
 public:
  /** seed the random number generator */
  static void seedRand(unsigned int seed) {
 std::srand(seed);
  }
};

}  // namespace g2o
...
```

v19.1.5
```cpp
namespace g2o {

class G2O_STUFF_API
Sampler{public :
            /** seed the random number generator */
            static void seedRand(unsigned int seed){std::srand(seed);
}
}
;

}  // namespace g2o
```

The `.clang-format` file is
```
BasedOnStyle: Google
DerivePointerAlignment: false
```

I noticed that formatting stays kind of as expected if I do not close the class definition by `};` but just `}` which is non working syntax however.

Locally I am using Ubuntu 24.10 with apt.llvm.org as additional package source.
```
$ clang-format --version
Ubuntu clang-format version 19.1.5 (++20241119043710+51dee6b64fda-1~exp1~20241119163724.28)
```

The same effect can however also be seen when using the pre-commit framework (with a slightly older version of clang-format), e.g., as in this PR of my project:
https://github.com/RainerKuemmerle/g2o/pull/837/files

Please let me know if I should provide additional information. Thanks.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to