[PATCH] D47191: [clang-format] Fix crash in getLengthToMatchingParen

Krasimir Georgiev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 02:50:52 PDT 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL332961: [clang-format] Fix crash in getLengthToMatchingParen (authored by krasimir, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D47191

Files:
  cfe/trunk/lib/Format/ContinuationIndenter.cpp


Index: cfe/trunk/lib/Format/ContinuationIndenter.cpp
===================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp
@@ -94,9 +94,9 @@
       break;
     if (!End->Next->closesScope())
       continue;
-    if (End->Next->MatchingParen->isOneOf(tok::l_brace,
-                                          TT_ArrayInitializerLSquare,
-                                          tok::less)) {
+    if (End->Next->MatchingParen &&
+        End->Next->MatchingParen->isOneOf(
+            tok::l_brace, TT_ArrayInitializerLSquare, tok::less)) {
       const ParenState *State = FindParenState(End->Next->MatchingParen);
       if (State && State->BreakBeforeClosingBrace)
         break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47191.147973.patch
Type: text/x-patch
Size: 784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/af326666/attachment.bin>


More information about the llvm-commits mailing list