[PATCH] D100460: [clang] Move deep copy into CompilerInvocation::clone

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 14 03:19:24 PDT 2021


jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith.
Herald added subscribers: martong, usaxena95, kadircet, arphaman, javed.absar.
jansvoboda11 requested review of this revision.
Herald added projects: clang, clang-tools-extra.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100460

Files:
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang/include/clang/Frontend/CompilerInvocation.h
  clang/lib/ARCMigrate/ARCMT.cpp
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Frontend/ChainedIncludesSource.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/PrecompiledPreamble.cpp
  clang/lib/Frontend/Rewrite/FrontendActions.cpp
  clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
  clang/unittests/Frontend/CompilerInvocationTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100460.337388.patch
Type: text/x-patch
Size: 11500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210414/7725b36f/attachment-0001.bin>


More information about the cfe-commits mailing list