constant.h 977 B

123456789101112131415161718192021222324252627
  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. #ifndef CARBON_TOOLCHAIN_CHECK_CPP_CONSTANT_H_
  5. #define CARBON_TOOLCHAIN_CHECK_CPP_CONSTANT_H_
  6. #include "clang/AST/APValue.h"
  7. #include "toolchain/check/context.h"
  8. #include "toolchain/sem_ir/ids.h"
  9. namespace Carbon::Check {
  10. // Converts an `APValue` to a Carbon `ConstantId`.
  11. auto MapAPValueToConstant(Context& context, SemIR::LocId loc_id,
  12. const clang::APValue& ap_value, clang::QualType type)
  13. -> SemIR::ConstantId;
  14. // Attempt to evaluate a call to a C++ constexpr/consteval function as a
  15. // Carbon constant.
  16. auto EvalCppCall(Context& context, SemIR::LocId loc_id,
  17. SemIR::ClangDeclId clang_decl_id, SemIR::InstBlockId args_id)
  18. -> SemIR::ConstantId;
  19. } // namespace Carbon::Check
  20. #endif // CARBON_TOOLCHAIN_CHECK_CPP_CONSTANT_H_