[PATCH] D80925: Fix compiler crash when trying to parse alignment argument as a constant expression.
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 1 10:46:06 PDT 2020
rjmccall added a comment.
Narrowly this seems to fix the immediate problem, but I feel like we're in trouble if tentative parsing is changing the semantic context in ways that persist. In particular, I'm concerned that we could end up tentatively parsing an ODR use as part of an expression and then completely discarding it, causing Sema to think that there's an ODR use later because it never sees an L2R conversion (because the expression is not actually used). Probably the most architectural thing would be for tentative expression parsing to push a possibly-unevaluated context, and then when we claim an expression annotation token we can do the retroactive work necessary to make it an expression in the proper context. We already have most of the logic to support that because of C99 `sizeof`, which is usually not evaluated but can be in the narrow circumstance of a VLA.
If we do decide to solve this more narrowly, then we should audit our use of the tentative-parsing queries to make sure that we're pushing contexts consistently, and we should leave comments in places like this to make sure that maintainers understand the subtleties.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80925/new/
https://reviews.llvm.org/D80925
More information about the cfe-commits
mailing list