This is an archive of the discontinued LLVM Phabricator instance.

[llb] Remove the user-defined copy-ctor in ConstString
ClosedPublic

Authored by JDevlieghere on Jul 23 2020, 9:39 AM.

Details

Summary

ConstString is essentially trivially copyable yet it has a user defined copy constructor that copies its one member pointer. Remove it so it qualifies as trivial in the eyes of the compiler.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

JDevlieghere created this revision.Jul 23 2020, 9:39 AM
shafik added a subscriber: shafik.Jul 23 2020, 11:50 AM
shafik added inline comments.
lldb/include/lldb/Utility/ConstString.h
45

Since your touching this type, why not modernize it and use an in class member initializer for m_string Then default the constructor.

teemperor accepted this revision.Jul 23 2020, 12:23 PM
teemperor added a subscriber: teemperor.

Btw, this might spawn a bunch of warnings about unused ConstString variables (I remember I did a similar change locally to find unused ConstStrings some time ago) as the compiler maybe now understands that empty ConstString construction/destruction doesn't have side effects. So you might want to check for them before committing. But LGTM

This revision is now accepted and ready to land.Jul 23 2020, 12:23 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2020, 1:09 PM