Seeing "`!HitMapping && "recursive macro expansion?"' assertion failure -- hoping for hints on cause

Hi folks (especially Ilya Biryukov),

I’m working with clangd under the Theia IDE, and while browsing source, I’m regularly seeing this assertion failure from clangd:

root ERROR C/C++: clangd: /repo/eahcmrh/flexc-llvm-project/clang/lib/Tooling/Syntax/Tokens.cpp:473: void clang::syntax::TokenCollector::Builder::consumeMapping(clang::syntax::TokenBuffer::MarkedFile&, unsigned int, unsigned int, unsigned int, unsigned int&): Assertion `!HitMapping && “recursive macro expansion?”’ failed.

Outside of working on some clang-tidy checks, I’ve had very little experience with clang front-end code, and I’m struggling to root cause this. Ilya, the assertion is coming from code you added about 5 months ago, so I’m hoping you might have some suggestions about what might cause this error, given that it is cropping up in unmodified source files that are known to compile.

I’m working on trying to extract some non-proprietary code that triggers the failure – if I’m able, I’ll file a bug for it. Regardless of whether I file a bug, I’d like to root-cause this and perhaps even identify a fix, because it is blocking some folks in my team from making progress on other objectives. I’d be grateful for any suggestions on where to look to narrow this down….

Thanks,

Chris

https://www.ericsson.com

Chris Hamilton

Compiler Developer

Developer

BNEW DNEW 4G5G BI BBI 10

Mobile: +15125673298

chris.hamilton@ericsson.com

Ericsson

1703 W. 5th Street Suite 600

78703,Austin, Texas

United States

ericsson.com

https://www.ericsson.com/current_campaign

Our commitment to Technology for Good and Diversity and Inclusion contributes to positive change.
Follow us on: Facebook LinkedIn Twitter

Legal entity:ERICSSON AB registration number 556056-6258, registered office in Stockholm.
This communication is confidential. Our email terms: www.ericsson.com/en/legal/privacy/email-disclaimer