[PATCH] D35955: clang-format: Add preprocessor directive indentation

Erik Uhlmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 14:23:47 PDT 2017


euhlmann added inline comments.


================
Comment at: lib/Format/UnwrappedLineParser.h:238
 
+  unsigned PPIndentLevel;
+  FormatToken *PPMaybeIncludeGuard;
----------------
djasper wrote:
> I think this should almost always be PPBranchLevel. Probably the different case is the #else itself, but I think we can handle that easily.
It doesn't look like PPBranchLevel can be used to differentiate between no indent and one level of indent, since it starts at -1 and then stays >=0. For example:
```
#define A     // -1
#if B         // -1
#  define C   // 0
#  if D       // 0
#    define E // 1
#  endif      // 0
#endif        // 0
#define F     // 0
```



https://reviews.llvm.org/D35955





More information about the cfe-commits mailing list