cpp_overload_set.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_SEM_IR_CPP_OVERLOAD_SET_H_
  5. #define CARBON_TOOLCHAIN_SEM_IR_CPP_OVERLOAD_SET_H_
  6. #include "clang/AST/Decl.h"
  7. #include "clang/AST/UnresolvedSet.h"
  8. #include "common/ostream.h"
  9. #include "toolchain/base/value_store.h"
  10. #include "toolchain/sem_ir/ids.h"
  11. namespace Carbon::SemIR {
  12. // An overloaded C++ function.
  13. struct CppOverloadSet : public Printable<CppOverloadSet> {
  14. // The function's name.
  15. NameId name_id;
  16. // The parent scope.
  17. NameScopeId parent_scope_id;
  18. // The naming class in the name lookup that found this overload set.
  19. clang::CXXRecordDecl* naming_class;
  20. // List of all named decls found at name lookup.
  21. // TODO: Find a good small size for the UnresolvedSet<size> or rework how we
  22. // store the candidates.
  23. clang::UnresolvedSet<4> candidate_functions;
  24. auto Print(llvm::raw_ostream& out) const -> void {
  25. out << "name: " << name_id << ", parent_scope: " << parent_scope_id;
  26. }
  27. };
  28. using CppOverloadSetStore = ValueStore<CppOverloadSetId, CppOverloadSet>;
  29. } // namespace Carbon::SemIR
  30. #endif // CARBON_TOOLCHAIN_SEM_IR_CPP_OVERLOAD_SET_H_