MyDeveloperDay added inline comments.

================
Comment at: clang/lib/Format/TokenAnnotator.cpp:847
     case tok::kw_while:
-      assert(!Line.startsWith(tok::hash));
-      if (Tok->is(tok::kw_if) && CurrentToken &&
-          CurrentToken->isOneOf(tok::kw_constexpr, tok::identifier))
-        next();
-      if (CurrentToken && CurrentToken->is(tok::l_paren)) {
-        next();
-        if (!parseParens(/*LookForDecls=*/true))
-          return false;
+      if (!Line.startsWith(tok::hash)) {
+        if (Tok->is(tok::kw_if) && CurrentToken &&
----------------
mitchell-stellar wrote:
> It's not clear to me whether or not the token should be consumed. The 
> previous assertion leads me to think no, and in that case, I think this 
> should be
> ```
> if (Line.startsWith(tok::hash))
>     return false;
> ```
> A comment on this would also be helpful.
to be honest I'm not sure what the assertion is trying to actually assert (I'm 
not a massive fan of assertions especially like this), just because I see while 
am I not expecting to see a # at the beginning of the line?

I've tried both yours, mine and removing it completely and none of the test 
fail, so I feel like imposing the "Beyonce rule!!" and getting rid of it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68707/new/

https://reviews.llvm.org/D68707



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

Reply via email to