Adds overload of TransformToPotentiallyEvaluated for TypeSourceInfo to
properly deal with VLAs in nested calls of sizeof and typeof. Fixes
PR31042 (https://github.com/llvm/llvm-project/issues/30390).
Details
- Reviewers
efriedma - Commits
- rG968be05b8fdc: [clang] Fix crash for sizeof on VLAs
Diff Detail
Event Timeline
Apologies for the delay over the holiday season, I will look into this later on after office hours.
Here's an updated patch including the test. Hope this is now ok for submission. Please accept my apologies with regards to the delay in submitting this.
@efriedma I have uploaded a new patch taking your comments into consideration and rebased on most recent clang sources.
test/SemaCXX/pr31042.cpp | ||
---|---|---|
1 | Oh, this testcase doesn't actually crash on trunk without at least -emit-llvm because semantic analysis doesn't actually verify the used bit. :( Better to include that, I think. |
test/SemaCXX/pr31042.cpp | ||
---|---|---|
2 | You need to use "-o -" or something like that to avoid generating a file pr31042.ll. Also, a comment explaining why this test is using -emit-llvm would be nice. |
test/SemaCXX/pr31042.cpp | ||
---|---|---|
1 | Ah, that's why I had initially -emit-obj. That also triggered the problem. I obviously forgot about this and removed the flag without retesting to check if still broke trunk. Apologies for that. | |
1 | And we also need to remove -fsyntax-only. Submitting new patch. |
Thanks for the review, but unfortunately I found an issue right before committing, taking a look at it now.
Ensure that we only call transform on Unevaluated Contexts, avoids the failure of a couple of vla tests.
Is the isUnevaluatedContext() check here necessary?