[clang] [clang]fix ppcaching assertion gh186582 (PR #187370)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 6 10:06:23 PDT 2026
AaronBallman wrote:
> > > @AaronBallman i have updated the test file as u said thanks for ur help really appreciate that but it was failing let me know what is the problem maybe putting the diag on one line can solve this problem ?
> >
> >
> > I don't have the bandwidth to debug it myself to know for sure, but what I _think_ is happening is that we used to call `Commit()` but still try to parse the type id so we'd get behavior like https://godbolt.org/z/qv6e1Thj8 where we emit a source range which includes the subsequent type from the following line. In your test case there's no type there to parse so we get one of the "expected type" diagnostics. However, the new `Revert()` calls mean we revert the token stream back to before the tentative parse, so I think we're trying to parse the type name twice (hence the second diagnostic) and the source location we're looking for that type is still on the next line. So I think it's actually a bug with the patch that we're emitting the diagnostic twice, and some more investigation is needed.
>
> Sorry for the late response @AaronBallman would returning `true` from `ParseOptionalCXXScopeSpecifier` after `TPA.Revert()` instead of `break` prevent the double parsing or there can be a better approach ?
I'm not certain off the top of my head; there's 40+ calls to that function, some of which inspect the returned value and some of which do not. In the case where we emit the error diagnostic, I think we should `return true` because the API's documentation says `/// \returns true if there was an error parsing a scope specifier`.
https://github.com/llvm/llvm-project/pull/187370
More information about the cfe-commits
mailing list