summaryrefslogtreecommitdiff
path: root/clang/unittests
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2023-04-13 00:27:40 -0700
committerOwen Pan <owenpiano@gmail.com>2023-04-14 13:58:38 -0700
commit293e4da32b1d823e63b2614e626bcd22649a8a15 (patch)
tree19eec7dd5ba98226de8f8e28df31d3e3b651428e /clang/unittests
parent10bfdbf3466e9d91aa651e96a0f05060e0eb75de (diff)
downloadllvm-293e4da32b1d823e63b2614e626bcd22649a8a15.tar.gz
[clang-format] Correctly indent comment above finalized PPDirective
Fixes #62107. Differential Revision: https://reviews.llvm.org/D148200
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Format/FormatTestComments.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestComments.cpp b/clang/unittests/Format/FormatTestComments.cpp
index 03d093bd5891..60e045059be8 100644
--- a/clang/unittests/Format/FormatTestComments.cpp
+++ b/clang/unittests/Format/FormatTestComments.cpp
@@ -1059,6 +1059,13 @@ TEST_F(FormatTestComments, KeepsLevelOfCommentBeforePPDirective) {
"#endif\n"
" }\n"
"}"));
+
+ const StringRef Code("void func() {\n"
+ " // clang-format off\n"
+ " #define KV(value) #value, value\n"
+ " // clang-format on\n"
+ "}");
+ EXPECT_EQ(Code, format(Code));
}
TEST_F(FormatTestComments, SplitsLongLinesInComments) {