[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros

Noah Goldstein via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 18:49:07 PDT 2022


goldstein.w.n added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:5056-5059
+               "        if (A) { \\\n"
+               "            B(); \\\n"
+               "        }        \\\n"
+               "        C();\n"
----------------
owenpan wrote:
> I just noticed that here and below you got an extra `IndentWidth` than in the summary, so the patch only works for `PPDIS_None`?
To a degree.

`Level` is used by both scope depth and PP depth so nested PP directives with before/after will essentially have `IndentWidth * (PPLevel + ScopeLevel)` as net indentation.

AFAICT `UnwrappedLineParser.cpp::parsePPDefine` needs to something other than `Line->Level` with `PBBranchLevel + 1`.

I started doing that but the diff got a bit bigger given that it needs to get propegated between Wrapper/Unwrapped/Annotated (AFAICT).

Would you prefer its implemented like that?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137181/new/

https://reviews.llvm.org/D137181



More information about the cfe-commits mailing list