[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-22 Thread Mark Zeren via Phabricator via cfe-commits
mzeren-vmw added a comment. In https://reviews.llvm.org/D42036#984401, @djasper wrote: > To me, aligning with the define seems fundamentally wrong. we definitely have code that does that internally. It can also be seen in the wild e.g.: https://github.com/boostorg/config/blob/develop/include/b

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-22 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added a comment. While I agree that there is probably a bug to fix, I don't (yet) agree with what is proposed in this patch. I think a comment in between preprocessor directives should always either: - Be considered part of the code in between the #-lines - Be considered to be commentin

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-22 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:1725 + NextNonComment.Type == LT_ImportStatement) && + NextNonComment.Level > 0 && !Comment.InPPDirective) +return NextNonComment.First->Next && Why are we checking `NextNonC

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-18 Thread Mark Zeren via Phabricator via cfe-commits
mzeren-vmw marked 2 inline comments as done. mzeren-vmw added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:1756 + if (Alignment == CA_Preprocessor) +(*I)->LevelOffset = 1; } else { krasimir wrote: > This feels a bit awkward: we're

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-18 Thread Mark Zeren via Phabricator via cfe-commits
mzeren-vmw updated this revision to Diff 130487. mzeren-vmw added a comment. Documented CommentAlignment enumerators. Documenting them suggested better enumerator names. Added tests for multi-line comments, block comments and trailing comments. Repository: rC Clang https://reviews.llvm.org/D

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-18 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:1710 +enum CommentAlignment { CA_None, CA_Code, CA_Preprocessor }; + Please comment these. Comment at: lib/Format/TokenAnnotator.cpp:1756 + if (Alignment == CA_Pre

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-16 Thread Mark Zeren via Phabricator via cfe-commits
mzeren-vmw added a comment. In https://reviews.llvm.org/D42036#976827, @klimek wrote: > Just from a formatting point of view, why not: > > //. Comment > #.define X (assuming the '.'s are unintentional) There is some logic in placing `//` in column 0, since we place `#` in column 0. H

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-16 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment. Just from a formatting point of view, why not: //. Comment #.define X Repository: rC Clang https://reviews.llvm.org/D42036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/ma

[PATCH] D42036: [clang-format] Keep comments aligned to macros

2018-01-14 Thread Mark Zeren via Phabricator via cfe-commits
mzeren-vmw created this revision. mzeren-vmw added reviewers: euhlmann, krasimir, klimek. Herald added a subscriber: cfe-commits. r312125, which introduced preprocessor indentation, shipped with a known issue where "indentation of comments immediately before indented preprocessor lines is toggled