[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 7 08:30:34 PDT 2023


================
@@ -66,16 +66,18 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
                          DiagnosticsEngine *Diags = nullptr,
                          bool DefaultDiagColor = true);
 
+namespace CompilerInvocationDetail {
 /// The base class of CompilerInvocation with reference semantics.
 ///
 /// This class stores option objects behind reference-counted pointers. This is
 /// useful for clients that want to keep some option object around even after
 /// CompilerInvocation gets destroyed, without making a copy.
 ///
-/// This is a separate class so that we can implement the copy constructor and
-/// assignment here and leave them defaulted in the rest of CompilerInvocation.
-class CompilerInvocationRefBase {
-public:
+/// This is a separate base class so that the client-facing sub-classes can
+/// simply declare the desired copy semantics without managing the internals
+/// themselves (for the most parts).
----------------
benlangmuir wrote:

Nit: "for the most part" is always with singular "part".  

https://github.com/llvm/llvm-project/pull/65412


More information about the cfe-commits mailing list