diff --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h index 8fc51e6ec03b6..1a2a39411e58d 100644 --- a/clang/include/clang/Frontend/CompilerInvocation.h +++ b/clang/include/clang/Frontend/CompilerInvocation.h @@ -201,6 +201,8 @@ class CompilerInvocationBase { /// @} }; +class CowCompilerInvocation; + /// Helper class for holding the data necessary to invoke the compiler. /// /// This class is designed to represent an abstract "invocation" of the @@ -220,6 +222,9 @@ class CompilerInvocation : public CompilerInvocationBase { } ~CompilerInvocation() = default; + explicit CompilerInvocation(const CowCompilerInvocation &X); + CompilerInvocation &operator=(const CowCompilerInvocation &X); + /// Const getters. /// @{ // Note: These need to be pulled in manually. Otherwise, they get hidden by diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 9555dbf663d33..691f3b989b81e 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -191,6 +191,17 @@ CompilerInvocationBase::shallow_copy_assign(const CompilerInvocationBase &X) { return *this; } +CompilerInvocation::CompilerInvocation(const CowCompilerInvocation &X) + : CompilerInvocationBase(EmptyConstructor{}) { + CompilerInvocationBase::deep_copy_assign(X); +} + +CompilerInvocation & +CompilerInvocation::operator=(const CowCompilerInvocation &X) { + CompilerInvocationBase::deep_copy_assign(X); + return *this; +} + namespace { template T &ensureOwned(std::shared_ptr &Storage) {