llvm / llvm-project

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

Add option to disable formatting of preprocessor #26551

Open llvmbot opened 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 26177
Version trunk
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

There are no options to control the style of preprocessor formatting. I don't know whether you have those in your roadmap but do I understand that adding those might be a lot of work. As a result, I think one good solution is to provide an option to disable formatting of preprocessor altogether. This one should be easy to add since it is trivial to distinguish preprocessor from real code. Of course 'clang-format on' and 'clang-format off' directives are an option but clearly spamming those across the whole project just around preprocessor is tedious and ugly. Looking forward to your feedback.

llvmbot commented 8 years ago

As of the current master version, this is not yet supported. Can I hope for this to be added in the upcoming LLVM/Clang releases?

I'd like to clarify that the C/C++ code inside of the preprocessor definitions should still be formatted as it is now as well as 'AlignEscapedNewlinesLeft' should still function as it does normally, while the only code that should not be formatted is the preprocessor.