This is an archive of the discontinued LLVM Phabricator instance.

[VLA] Handle VLA size expression in a full-expression context.
ClosedPublic

Authored by timshen on Sep 8 2016, 2:23 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

timshen updated this revision to Diff 70665.Sep 8 2016, 2:23 AM
timshen retitled this revision from to [CleanupInfo] Use cleanupsHaveSideEffects instead of exprNeedsCleanups in assertions.
timshen updated this object.
timshen added a reviewer: rsmith.
timshen added a subscriber: cfe-commits.
timshen updated this revision to Diff 70667.Sep 8 2016, 2:28 AM

Update the test file name and remove unused code.

rsmith added inline comments.Jan 30 2017, 1:26 PM
clang/test/SemaCXX/pr30306.cpp
5 ↗(On Diff #70667)

Shouldn't we be (somehow) handling the cleanups from the array bound expression here -- either discarding them or attaching them to the array bound? Looks like TreeTransform::TransformVariableArrayType is missing a call to ActOnFinishFullExpr.

If we modify the test to:

struct A { A(int); ~A(); };
int f(const A &);
template<typename T> void g() { int a[f(3)]; }
int main() { g<int>(); }

... we need to register the ~A() destructor to actually be run at some point.

timshen updated this revision to Diff 86375.Jan 30 2017, 5:46 PM

Fix in the right way as rsmith pointed out.

timshen updated this revision to Diff 86377.Jan 30 2017, 5:58 PM

ActOnFinishFullExpr after exiting the expression evaluation context.

timshen retitled this revision from [CleanupInfo] Use cleanupsHaveSideEffects instead of exprNeedsCleanups in assertions to [VLA] Handle VLA size expression in a full-expression context..Jan 30 2017, 5:59 PM
timshen edited the summary of this revision. (Show Details)
rsmith accepted this revision.Feb 14 2017, 2:51 PM
This revision is now accepted and ready to land.Feb 14 2017, 2:51 PM
This revision was automatically updated to reflect the committed changes.