goldstein.w.n created this revision. Herald added a project: All. goldstein.w.n requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
I.e with: PPIndentWidth = 1 IndentWidth = 4 ``` #ifdef foo #define bar() if (A) { B(); } C(); #endif ``` Assume ColumnLimit Here: | IndentPPDirectives: None ``` #ifdef foo #define bar() \ if (A) { \ B(); \ } \ C(); \ #endif ``` As opposed to ``` #ifdef foo #define bar() \ if (A) { \ B(); \ } \ C(); #endif ``` IndentPPDirectives: AfterHash ``` #ifdef foo # define bar() \ if (A) { \ B(); \ } \ C(); \ #endif ``` As opposed to ``` #ifdef foo # define bar() \ if (A) { \ B(); \ } \ C(); #endif ``` IndentPPDirectives: BeforeHash ``` #ifdef foo #define bar() \ if (A) { \ B(); \ } \ C(); \ #endif ``` As opposed to ``` #ifdef foo #define bar() \ if (A) { \ B(); \ } \ C(); #endif ``` Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D137181 Files: clang/lib/Format/UnwrappedLineFormatter.cpp Index: clang/lib/Format/UnwrappedLineFormatter.cpp =================================================================== --- clang/lib/Format/UnwrappedLineFormatter.cpp +++ clang/lib/Format/UnwrappedLineFormatter.cpp @@ -60,7 +60,7 @@ // Update the indent level cache size so that we can rely on it // having the right size in adjustToUnmodifiedline. skipLine(Line, /*UnknownIndent=*/true); - if (Line.InPPDirective || + if ((Line.InPPDirective && !Line.InMacroBody) || (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHash && Line.Type == LT_CommentAbovePPDirective)) { unsigned IndentWidth =
Index: clang/lib/Format/UnwrappedLineFormatter.cpp =================================================================== --- clang/lib/Format/UnwrappedLineFormatter.cpp +++ clang/lib/Format/UnwrappedLineFormatter.cpp @@ -60,7 +60,7 @@ // Update the indent level cache size so that we can rely on it // having the right size in adjustToUnmodifiedline. skipLine(Line, /*UnknownIndent=*/true); - if (Line.InPPDirective || + if ((Line.InPPDirective && !Line.InMacroBody) || (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHash && Line.Type == LT_CommentAbovePPDirective)) { unsigned IndentWidth =
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits