Skip to content

Commit

Permalink
[clang][deps] Implement move-conversion for CowCompilerInvocation (…
Browse files Browse the repository at this point in the history
…follow-up)
  • Loading branch information
jansvoboda11 committed Mar 2, 2024
1 parent 864593b commit 164c098
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clang/include/clang/Frontend/CompilerInvocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 11 additions & 0 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
T &ensureOwned(std::shared_ptr<T> &Storage) {
Expand Down

0 comments on commit 164c098

Please sign in to comment.