This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Fix a crash when updating a zeroinitialize designated initializer
ClosedPublic

Authored by erik.pilkington on Nov 1 2018, 4:32 PM.

Details

Summary

LLVM IR, in it's infinite wisdom, doesn't relate ConstantAggregate and ConstantAggregateZero through inheritance, so make sure we handle both cases here. Fixes a crash-on-valid.

rdar://45691981

Thanks for taking a look!
Erik

Diff Detail

Event Timeline

erik.pilkington created this revision.Nov 1 2018, 4:32 PM
rjmccall added inline comments.Nov 1 2018, 9:36 PM
clang/lib/CodeGen/CGExprConstant.cpp
1142

Is getAggregateElement not good enough here?

erik.pilkington marked an inline comment as done.

Use getAggregateElement. Thanks!

clang/lib/CodeGen/CGExprConstant.cpp
1142

No, getAggregateElement is perfect, I just didn't know it existed!

rjmccall accepted this revision.Nov 2 2018, 8:39 AM

LGTM.

This revision is now accepted and ready to land.Nov 2 2018, 8:39 AM
This revision was automatically updated to reflect the committed changes.