mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:50:13 +01:00
Synthesize an impl of `Destroy` for C++ classes in response to impl lookup.
24 lines
814 B
C++
24 lines
814 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#include "toolchain/lower/clang_global_decl.h"
|
|
namespace Carbon::Lower {
|
|
|
|
auto CreateGlobalDecl(const clang::NamedDecl* decl) -> clang::GlobalDecl {
|
|
if (const auto* constructor_decl =
|
|
dyn_cast<clang::CXXConstructorDecl>(decl)) {
|
|
return clang::GlobalDecl(constructor_decl,
|
|
clang::CXXCtorType::Ctor_Complete);
|
|
}
|
|
|
|
if (const auto* destructor_decl = dyn_cast<clang::CXXDestructorDecl>(decl)) {
|
|
return clang::GlobalDecl(destructor_decl,
|
|
clang::CXXDtorType::Dtor_Complete);
|
|
}
|
|
|
|
return clang::GlobalDecl(decl);
|
|
}
|
|
|
|
} // namespace Carbon::Lower
|