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

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 23:20:21 PST 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.h:66
+  /// #endif                PPLevel still at : 0
+  int PPLevel;
+
----------------
goldstein.w.n wrote:
> owenpan wrote:
> > You need to initialize `PPLevel` in the constructor. FWIW I'd use `unsigned` to be consistent with `Level` above.
> Will initialize. It's `int` because we do a less than zero check in the Formatter.
> It's `int` because we do a less than zero check in the Formatter.

If you set `PPLevel` to `PPBranchLevel` when there is no header guard, and to `PPBranchLevel + 1`otherwise, `PPLevel` can never be negative.


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