[PATCH] D24400: Also cleanup comments around redundant colons/commas in format::cleanup.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 9 10:24:19 PDT 2016


djasper added inline comments.

================
Comment at: lib/Format/Format.cpp:1141
@@ -1134,1 +1140,3 @@
         deleteToken(DeleteLeft ? Left : Right);
+        // Delete all comments between `Left` and `Right`.
+        for (auto *Comment : Comments)
----------------
Couldn't you just do:

  for (auto *Tok = Left->Next; Tok && Tok != Right; Tok = Tok->Next)
    if (Tok->is(tok::comment))
      deleteToken(Comment);

That way you wouldn't have to store the comments in a vector.


https://reviews.llvm.org/D24400





More information about the cfe-commits mailing list