[PATCH] D35955: clang-format: Add preprocessor directive indentation
Erik Uhlmann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 23 13:51:20 PDT 2017
euhlmann added inline comments.
================
Comment at: lib/Format/UnwrappedLineParser.cpp:737
+ for (auto& Line : Lines) {
+ if (Line.InPPDirective && Line.Level > 0)
+ --Line.Level;
----------------
krasimir wrote:
> Wouldn't this also indent lines continuing macro definitions, as in:
> ```
> #define A(x) int f(int x) { \
> return x; \
> }
> ```
Multi-line macros look this under this patch
```
#if A
# define MACRO \
void a(int x) { \
b(); \
c(); \
d(); \
e(); \
f(); \
}
#endif
```
With previous clang-format, no preprocessor indentation:
```
#if A
#define MACRO \
void a(int x) { \
b(); \
c(); \
d(); \
e(); \
f(); \
}
#endif
```
https://reviews.llvm.org/D35955
More information about the cfe-commits
mailing list