This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Fix PR38987: keep end location of a direct initializer list
ClosedPublic

Authored by orivej on Oct 12 2018, 5:19 PM.

Details

Summary

If PerformConstructorInitialization of a direct initializer list constructor is called while instantiating a template, it has brace locations in its BraceLoc arguments but not in the Kind argument.

This reverts the hunk https://reviews.llvm.org/D41921#inline-468844.

Diff Detail

Repository
rC Clang

Event Timeline

orivej created this revision.Oct 12 2018, 5:19 PM
vsk added a comment.Oct 13 2018, 5:10 PM

Thanks for looking into this! Do you know why the InitializationKind doesn't contain the right brace locations in this scenario? Should it?

I don't have the complete picture yet. (This is why the summary is so short.)
I have looked up that IK_DirectList Kind was known not to carry a valid ParenRange since https://github.com/llvm-mirror/clang/commit/188158db29f50443b6e412f2a40c800b2669c957, and that PerformConstructorInitialization acquired BraceLoc arguments specifically to support CXXTemporaryObjectExpr: https://github.com/llvm-mirror/clang/commit/1245a54ca6e9c5b14196461dc3f84b24ea6594b1#diff-d7cc8293491a9fdddee7ba857c028256R5921 , but then it appears that CXXTemporaryObjectExpr Kind has acquired a valid ParenRange, except when it is instantiated from a template…

D41921 was the last big change necessary to fix clang crashes on code coverage, but without the fixup in this review clang crashes on about 1.5 times more projects that I maintain than before. It seems useful to include this in the 7.0.1 release. (After the fixup the only crasher is scipy, being dealt with in D53244.)

vsk accepted this revision.Nov 18 2018, 9:04 PM

The history seems complicated. I think it'd be really useful to sort out why getParenOrBraceRange() couldn't give the right result, but I'd be happy to see this land first to address the crash.

This revision is now accepted and ready to land.Nov 18 2018, 9:04 PM
This revision was automatically updated to reflect the committed changes.