[clang] New indent pp directives before hash with code (PR #186686)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 15 12:38:12 PDT 2026
================
@@ -3889,10 +3925,20 @@ bool UnwrappedLineParser::parseEnum() {
if (!Style.AllowShortEnumsOnASingleLine) {
addUnwrappedLine();
Line->Level += 1;
+ } else if (Style.IndentPPDirectives ==
+ FormatStyle::PPDIS_BeforeHashWithCode) {
+ // For BeforeHashWithCode, flush the enum declaration as its own
+ // UnwrappedLine (like AllowShortEnumsOnASingleLine=false does) so that
+ // body tokens start in a fresh line. Each PP-separated segment of the
+ // body can then be emitted at its correct indentation via BWHCCodeLine.
+ addUnwrappedLine();
----------------
HazardyKnusperkeks wrote:
You do the same as the `if`, and then after `parseBracedList` again. Just store the condition in a bool, and merge both places.
https://github.com/llvm/llvm-project/pull/186686
More information about the cfe-commits
mailing list