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_Preprocessor)
+        (*I)->LevelOffset = 1;
     } else {
----------------
This feels a bit awkward: we're adding code that implicitly assumes the exact 
style the preprocessor directives and comments around them are handled. Maybe 
if this could become part of the level itself, it would feel less awkward.


================
Comment at: lib/Format/TokenAnnotator.h:41
   AnnotatedLine(const UnwrappedLine &Line)
-      : First(Line.Tokens.front().Tok), Level(Line.Level),
+      : First(Line.Tokens.front().Tok), Level(Line.Level), LevelOffset(0),
         MatchingOpeningBlockLineIndex(Line.MatchingOpeningBlockLineIndex),
----------------
Is there a way to not introduce `LevelOffset`, but have it part of `Level`?


================
Comment at: unittests/Format/FormatTest.cpp:2619
+                           "#endif\n"
+                           "#endif";
+    EXPECT_EQ(Expected, format(ToFormat, Style));
----------------
I would like to see test including multiline `//`-comment sections before, 
inside and after preprocessor directives as well as `/**/`-style comments.


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