This is an archive of the discontinued LLVM Phabricator instance.

Pass ConstString by value
ClosedPublic

Authored by aprantl on Mar 6 2019, 9:29 AM.

Details

Summary

My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed.

I technically only need one of these changes to fix a taking-reference-of-local-object bug that Jason discovered on the swift-lldb branch, but while I'm at it I thought I might as well do all at once.

ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object.

(This fixes rdar://problem/48640859 for the Apple folks)

Diff Detail

Repository
rL LLVM

Event Timeline

aprantl created this revision.Mar 6 2019, 9:29 AM
Herald added a project: Restricted Project. · View Herald Transcript
aprantl edited the summary of this revision. (Show Details)Mar 6 2019, 9:33 AM
jasonmolenda accepted this revision.Mar 6 2019, 1:14 PM

Looks good to me.

lldb/www/architecture/varformats.html
121 ↗(On Diff #189523)

big bug! :)

This revision is now accepted and ready to land.Mar 6 2019, 1:14 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2019, 1:22 PM