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

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 20 13:52:03 PST 2024


================
@@ -233,6 +233,10 @@ MacroExpander::expand(FormatToken *ID,
   if (Result.size() > 1) {
     ++Result[0]->MacroCtx->StartOfExpansion;
     ++Result[Result.size() - 2]->MacroCtx->EndOfExpansion;
+  } else {
+    // If the macro expansion is empty, mark the start and end
----------------
HazardyKnusperkeks wrote:

```suggestion
    // If the macro expansion is empty, mark the start and end.
```

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


More information about the cfe-commits mailing list