[clang] [clang] Fix a segfault when M is a nullptr (PR #130712)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 23:15:51 PDT 2025


matts1 wrote:

I have a repro, but it may be addressing the symptoms rather than the root cause.

AFAICT, a macro should *always* have an associated module (not sure how the implementation works without modules though).

However, the root cause of the issue appears to be that in the example I provided with the test case, the `ModuleMacro` constructor is called with `OwningModule` set to null. I'm not familiar enough with the code, however, to say if that's working as intended. I'm hoping someone more knowledgable than me could answer that.

https://github.com/llvm/llvm-project/blob/6abe19ac587d36edf202830cbbceecfd1a55f191/clang/include/clang/Lex/MacroInfo.h#L532

I'm happy to submit this as is, since a header guard can't hurt, but it may just hide the problem.

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


More information about the cfe-commits mailing list