[PATCH] D103722: [clang] NFC: test for undefined behaviour in RawComment::getFormattedText()

Dmitry Polukhin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 7 02:12:57 PDT 2021


DmitryPolukhin updated this revision to Diff 350205.
DmitryPolukhin added a comment.

Fix clang-tidy warning


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103722/new/

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.
+  const char *ExpectedOutput = "";
+  auto Formatted = formatComment("//!<");
+  EXPECT_EQ(ExpectedOutput, Formatted);
+}
+
 } // namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103722.350205.patch
Type: text/x-patch
Size: 503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210607/e3809a0a/attachment.bin>


More information about the cfe-commits mailing list