[clang] [clang-format] Don't crash on incomplete template declaration (PR #173433)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 23 22:50:02 PST 2025


================
@@ -29053,6 +29053,8 @@ TEST_F(FormatTest, KeywordedFunctionLikeMacros) {
                Style);
 }
 
+TEST_F(FormatTest, DoesNotCrashIncompleteCode) { verifyNoCrash("template <"); }
----------------
owenca wrote:

```suggestion
TEST_F(FormatTest, UnbalancedAngleBrackets) { verifyFormat("template <"); }
```
We can put this test case and the one from #173456 in the same `TEST_F`. Also, it's better to use `verifyFormat` for incomplete code as some editors support formatting as you type.

https://github.com/llvm/llvm-project/pull/173433


More information about the cfe-commits mailing list