sammccall added a comment.

I'm not familiar with clang-format internals, sorry if questions are dumb.

My first inclination is that doing something reasonable for incomplete inputs 
makes sense, but it doesn't seem to be worth spending complexity on things that 
are actually intended to not be protos - people should just not use R"pb in 
this case.

I recall you had a reason for wanting to try this out anyway though, but I 
can't remember what it is. (Can you add it to the description?)



================
Comment at: lib/Format/TokenAnnotator.cpp:665
       }
+      if ((Style.Language == FormatStyle::LK_Proto ||
+           Style.Language == FormatStyle::LK_TextProto) &&
----------------
I don't really understand what this is doing.
It seems to be detecting some particular sequence of invalid tokens 
`}:`,`]:`,`>:`. Why are these special? 

What's the contract of consumeToken()? It's hard to see from the callsites.


================
Comment at: lib/Format/TokenAnnotator.cpp:773
     case tok::r_brace:
-      // Lines can start with '}'.
-      if (Tok->Previous)
+      // Lines can start with '}' except in text protos.
+      if (Tok->Previous || Style.Language == FormatStyle::LK_TextProto)
----------------
In what sense of "line" is this true?


Repository:
  rC Clang

https://reviews.llvm.org/D44203



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

Reply via email to