AaronBallman wrote:

> > I kind of wonder if it would make sense for us to have a recovery function 
> > that can be called consistently.
> 
> Thanks, that’s a fair point. I explored this further and believe that this 
> inconsistency is a deliberate choice between different recovery strategies, 
> each with its own trade-offs. Attempting to normalize these into a single 
> strategy is a rabbit hole that causes various regressions.

Thank you for doing that exploratory work, it's really appreciated!

> Back to the current fix: the preprocessor cache remains correctly updated 
> (the `Pos`) and the text buffer stays aligned with the written source code (I 
> think this is by designed).
> 
> The issue is because this specific recovery path manually sets the current 
> Token to `;` regardless of the actual source content. The assertion fails 
> because it expects the token stream to match this synthetic parser state. 
> Given that, removing the assertion seems reasonable to me.
> 
> I am less certain about modifying the preprocessor state to match the parser 
> state, that feels like a much riskier change.

Okay, that seems reasonable to me.

https://github.com/llvm/llvm-project/pull/188123
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to