[PATCH] D103722: [clang] NFC: test for undefined behaviour in RawComment::getFormattedText()
Dmitry Polukhin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 4 14:54:13 PDT 2021
DmitryPolukhin created this revision.
DmitryPolukhin added reviewers: teemperor, obruns, bruno.
DmitryPolukhin requested review of this revision.
Herald added a project: clang.
This diff adds testcase for the issue fixed in https://reviews.llvm.org/D77468
but regression test was not added in the diff. On Clang 9 it caused
crash in cland during code completion.
Test Plan: check-clang-unit
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103722
Files:
clang/unittests/AST/CommentTextTest.cpp
Index: clang/unittests/AST/CommentTextTest.cpp
===================================================================
--- clang/unittests/AST/CommentTextTest.cpp
+++ clang/unittests/AST/CommentTextTest.cpp
@@ -124,4 +124,11 @@
// clang-format on
}
+TEST_F(CommentTextTest, EmptyFormattedText) {
+ // Test that empty formatted text doesn't cause crash.
+ auto ExpectedOutput = "";
+ auto Formatted = formatComment("//!<");
+ EXPECT_EQ(ExpectedOutput, Formatted);
+}
+
} // namespace clang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103722.349977.patch
Type: text/x-patch
Size: 496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210604/0c4177a8/attachment.bin>
More information about the cfe-commits
mailing list