This allows to set a different indent width for preprocessor statements.
Example:
#ifdef __linux_ # define FOO #endif int main(void) { return 0; }
Paths
| Differential D103286
[clang-format] Add PPIndentWidth option ClosedPublic Authored by gergap on May 27 2021, 2:01 PM.
Details Summary This allows to set a different indent width for preprocessor statements. Example: #ifdef __linux_ # define FOO #endif int main(void) { return 0; }
Diff Detail
Event TimelineComment Actions Love it! But this will result in unexpected (one might say breaking) behaviour, if someone set IndentWidth to a different value than his base style and update clang-format without adding a setting for PPIndentWidth. So in my opinion it should have a different default value, which always picks up IndentWidth until PPIndentWidth is explicitly set. Either some form of optional, or for me -1 is also fine, but I know others are more reluctant to use -1.
This revision now requires changes to proceed.May 29 2021, 8:59 AM HazardyKnusperkeks added inline comments.
Comment Actions I fixed the review findings and changed the behavior to be better backwards compatible by using PPIndentWidth=-1 by default.
Comment Actions Looks good to me, I would just change the wording a bit. Could you please also add a entry in the ReleaseNotes.rst?
This revision is now accepted and ready to land.May 31 2021, 5:47 AM
Closed by commit rG6f605b8d0bc1: [clang-format] Add PPIndentWidth option (authored by gergap, committed by HazardyKnusperkeks). · Explain WhyJun 3 2021, 8:55 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 348794 clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTest.cpp
|
I prefer alphabetical sorting, I know there are some entries which aren't sorted.