Author: Dmitry Polukhin Date: 2021-06-07T03:05:00-07:00 New Revision: aa0d7179bbb3fd24bc9eb1fd6203565dbd50e8d8
URL: https://github.com/llvm/llvm-project/commit/aa0d7179bbb3fd24bc9eb1fd6203565dbd50e8d8 DIFF: https://github.com/llvm/llvm-project/commit/aa0d7179bbb3fd24bc9eb1fd6203565dbd50e8d8.diff LOG: [clang] NFC: test for undefined behaviour in RawComment::getFormattedText() 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 Differential Revision: https://reviews.llvm.org/D103722 Added: Modified: clang/unittests/AST/CommentTextTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/AST/CommentTextTest.cpp b/clang/unittests/AST/CommentTextTest.cpp index 3de6758e45b6e..b697828698d85 100644 --- a/clang/unittests/AST/CommentTextTest.cpp +++ b/clang/unittests/AST/CommentTextTest.cpp @@ -124,4 +124,11 @@ R"cpp( // clang-format on } +TEST_F(CommentTextTest, EmptyFormattedText) { + // Test that empty formatted text doesn't cause crash. + const char *ExpectedOutput = ""; + auto Formatted = formatComment("//!<"); + EXPECT_EQ(ExpectedOutput, Formatted); +} + } // namespace clang _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits