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

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 18 19:59:30 PST 2024


================
@@ -217,6 +217,19 @@ TEST_F(MacroCallReconstructorTest, Identifier) {
   EXPECT_THAT(std::move(Unexp).takeResult(), matchesLine(line(U.consume("X"))));
 }
 
+TEST_F(MacroCallReconstructorTest, EmptyExpansion) {
+  auto Macros = createExpander({"A(x)=y"});
----------------
owenca wrote:

Changing `y` to `x` causes an assertion failure.

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


More information about the cfe-commits mailing list