[PATCH] Preserve hanging indent when breaking line comments.

Alexander Kornienko alexfh at google.com
Mon Mar 10 04:05:44 PDT 2014



================
Comment at: lib/Format/BreakableToken.cpp:190
@@ +189,3 @@
+    "///                                                        ",
+    "//                                                         "
+  };
----------------
Manuel Klimek wrote:
> Is there a reason we only want to allow the number of spaces in this string? Otherwise, I'd find an implementation that just has /// and // in the KnownPrefixes and then says || Comment[PrefixLength] == ' ' a lot less unexpected.
Changed this method to return a StringRef pointing to the argument.

================
Comment at: lib/Format/BreakableToken.cpp:187
@@ -186,2 +186,3 @@
 
 static StringRef getLineCommentPrefix(StringRef Comment) {
+  static const char *const KnownPrefixes[] = {
----------------
Manuel Klimek wrote:
> This is unrelated, but perhaps getLineCommentIndentPrefix or something would be clearer (I somehow expected us to try to find a more generic prefix).
Done.


http://llvm-reviews.chandlerc.com/D2988



More information about the cfe-commits mailing list