This is an archive of the discontinued LLVM Phabricator instance.

[WIP][clang] Move deep copy into CompilerInvocation::clone
Changes PlannedPublic

Authored by jansvoboda11 on Apr 14 2021, 3:19 AM.

Details

Summary

The copy constructor of CompilerInvocation performs a deep copy of the reference-counted pointers stored in its base class.

This behaviour might be surprising, since it doesn't follow the default semantics of std::shared_ptr and llvm::IntrusiveRefCntPtr.

In this patch, the copy constructor is declared private and the clone() method is introduced, making the behaviour obvious.

Depends on D100473.

WIP: Before landing this and advertising the deep copy functionality, we should clear up ownership of PreprocessorOptions::RemappedFileBuffers.

Diff Detail

Event Timeline

jansvoboda11 created this revision.Apr 14 2021, 3:19 AM
jansvoboda11 requested review of this revision.Apr 14 2021, 3:19 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 14 2021, 3:19 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 planned changes to this revision.Apr 14 2021, 3:25 AM
jansvoboda11 retitled this revision from [clang] Move deep copy into CompilerInvocation::clone to [WIP][clang] Move deep copy into CompilerInvocation::clone.
jansvoboda11 edited the summary of this revision. (Show Details)
jansvoboda11 planned changes to this revision.Apr 16 2021, 2:32 AM

Rebase, delete RefBase copy assignment

jansvoboda11 planned changes to this revision.Apr 19 2021, 6:46 AM
martong removed a subscriber: martong.Jul 28 2021, 9:25 AM