operators.h 1.2 KB

123456789101112131415161718192021222324252627282930
  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_OPERATORS_H_
  5. #define CARBON_TOOLCHAIN_CHECK_CPP_OPERATORS_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/check/operator.h"
  8. #include "toolchain/sem_ir/ids.h"
  9. namespace Carbon::Check {
  10. // Looks up the given operator in the Clang AST generated when importing C++
  11. // code using argument dependent lookup (ADL) and return overload set
  12. // instruction.
  13. auto LookupCppOperator(Context& context, SemIR::LocId loc_id, Operator op,
  14. llvm::ArrayRef<SemIR::InstId> arg_ids) -> SemIR::InstId;
  15. // Returns whether the decl is an operator member function.
  16. auto IsCppOperatorMethodDecl(clang::Decl* decl) -> bool;
  17. // Returns whether the specified instruction refers to a C++ overloaded operator
  18. // that is a method. If so, the first operand will be passed as `self` rather
  19. // than as the first argument.
  20. auto IsCppOperatorMethod(Context& context, SemIR::InstId inst_id) -> bool;
  21. } // namespace Carbon::Check
  22. #endif // CARBON_TOOLCHAIN_CHECK_CPP_OPERATORS_H_