clang_global_decl.cpp 814 B

1234567891011121314151617181920212223
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "toolchain/lower/clang_global_decl.h"
  5. namespace Carbon::Lower {
  6. auto CreateGlobalDecl(const clang::NamedDecl* decl) -> clang::GlobalDecl {
  7. if (const auto* constructor_decl =
  8. dyn_cast<clang::CXXConstructorDecl>(decl)) {
  9. return clang::GlobalDecl(constructor_decl,
  10. clang::CXXCtorType::Ctor_Complete);
  11. }
  12. if (const auto* destructor_decl = dyn_cast<clang::CXXDestructorDecl>(decl)) {
  13. return clang::GlobalDecl(destructor_decl,
  14. clang::CXXDtorType::Dtor_Complete);
  15. }
  16. return clang::GlobalDecl(decl);
  17. }
  18. } // namespace Carbon::Lower