owenpan accepted this revision.
owenpan added inline comments.

================
Comment at: clang/lib/Format/TokenAnnotator.cpp:123
 private:
+  ScopeType getScopeType(FormatToken &Token) {
+    switch (Token.getType()) {
----------------
As suggested before.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1195-1198
+      // Handle unbalanced braces.
+      if (!Scopes.empty())
+        Scopes.pop_back();
       // Lines can start with '}'.
----------------
dkt01 wrote:
> owenpan wrote:
> > dkt01 wrote:
> > > owenpan wrote:
> > > > I don't think it's about unbalanced braces here.
> > > `if (!Scopes.empty())` handles unbalanced braces.  `if(Tok->Previous)` 
> > > handles the case where a line starts with an rbrace.
> > I can't think of an example. Do you have one?
> The format unit test `FormatUnbalancedStructuralElements` feeds in strings 
> that have only right braces, so without this check the pop fails.
Thanks!


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

https://reviews.llvm.org/D141959

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

Reply via email to