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

Erik Uhlmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 11:09:55 PDT 2017


euhlmann added inline comments.


================
Comment at: lib/Format/UnwrappedLineParser.cpp:701
+      PPMaybeIncludeGuard->TokenText == FormatTok->TokenText &&
+      PPIndentLevel > 0) {
+    --PPIndentLevel;
----------------
djasper wrote:
> I think you'll need substantially more tests here:
> - An include guard must not have a #else 
> - An include guard must span the entire file
It sounds like these would require two passes, since we wouldn't know until the end whether an include guard spans the whole file or has a #else. Do we really want two passes? Or do you have any advice on how these tests can be implemented?


https://reviews.llvm.org/D35955





More information about the cfe-commits mailing list