[clang] [clang-format] Fix crashes when the macro expansion is empty (PR #119428)

via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 15 23:36:27 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff f4081711f0884ec7afe93577e118ecc89cb7b1cf 1e79973ed4ea56c66f8b7eb1db9d00784edac7f0 --extensions cpp -- clang/lib/Format/MacroExpander.cpp clang/unittests/Format/MacroCallReconstructorTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index 222e689f86..083d6f8174 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -226,7 +226,8 @@ TEST_F(MacroCallReconstructorTest, EmptyExpansion) {
   Unexp.addLine(line(Exp.getTokens()));
   EXPECT_TRUE(Unexp.finished());
   Matcher U(Call, Lex);
-  EXPECT_THAT(std::move(Unexp).takeResult(), matchesLine(line(U.consume("A()"))));
+  EXPECT_THAT(std::move(Unexp).takeResult(),
+              matchesLine(line(U.consume("A()"))));
 }
 
 TEST_F(MacroCallReconstructorTest, NestedLineWithinCall) {

``````````

</details>


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


More information about the cfe-commits mailing list