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 `NextNonComment.Level > 0` here? We could be aligned with 
the next preprocessor directive even at level 0.


================
Comment at: lib/Format/TokenAnnotator.cpp:1729
+                    NextNonComment.First->Next->OriginalColumn)
+               ? CA_Directive
+               : CA_None;
----------------
I think this should be enabled only if preprocessor indentation has been 
enabled.


================
Comment at: lib/Format/TokenAnnotator.cpp:1761
+      if (Alignment == CA_Directive)
+        (*I)->LevelOffset = 1;
     } else {
----------------
Could you add a comment that this `1` comes from the `#` in the preprocessor 
directive?


================
Comment at: unittests/Format/FormatTest.cpp:2629
+                           "#  define B 0\n"
+                           "   // Trailing aligned comment\n"
+                           "#endif\n"
----------------
I would expect this comment to be aligned with the `#endif` on the next line.


================
Comment at: unittests/Format/FormatTest.cpp:2657
+                           " * Trailing aligned comment\n"
+                           " */\n"
+                           "#endif\n"
----------------
Same here.


Repository:
  rC Clang

https://reviews.llvm.org/D42036



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to