[PATCH] D19106: Fixed a bug in AnnotatedLine::startsWith when there are comments in the line.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 04:30:17 PDT 2016


djasper added a comment.

Can you add a test?


================
Comment at: lib/Format/TokenAnnotator.h:143
@@ +142,3 @@
+      Tok = Tok->Next;
+    return startsWithInternal(Tok, K1) &&
+           startsWithInternal(Tok->Next, Tokens...);
----------------
It's a bit subtle that this works even if Tok is nullptr at this point. Maybe change to

  return Tok && startsWithInternal( ...

to make this more clear.


http://reviews.llvm.org/D19106





More information about the cfe-commits mailing list