[PATCH] D31441: [clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 15:06:48 PDT 2017


krasimir added a comment.

Looks good! I just have two nits.



================
Comment at: lib/Format/NamespaceEndCommentsFixer.cpp:139
+    }
     if (NamespaceTok->isNot(tok::kw_namespace))
       continue;
----------------
I'd instead just add a guard check at old line 136: 
```
if (!NamespaceTok || NamespaceTok->isNot(tok::kw_namespace))
  continue;
```


================
Comment at: unittests/Format/NamespaceEndCommentsFixerTest.cpp:586
+
+TEST_F(NamespaceEndCommentsFixerTest, PR32438) {
+  EXPECT_EQ("template <int> struct a {};\n"
----------------
I'd make the test name a bit descriptive; something like:
`HandlesInlineAtEndOfLine_PR32438`


https://reviews.llvm.org/D31441





More information about the cfe-commits mailing list