mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Extend CppRangeForIterate to support ADL begin/end (#7230)
`CppRangeForIterate` needs to support finding `begin()`/`end()` as a pair of methods and as a pair of ADL-findable functions. This change adds the ADL component, which lets us also diagnose types that don't implement the interface. Unlike methods, we apparently have support for overloads when using ADL.
This commit is contained in:
@@ -745,8 +745,8 @@ auto IsCppOperatorMethod(Context& context, SemIR::InstId inst_id) -> bool {
|
||||
return function_decl && IsCppOperatorMethodDecl(function_decl);
|
||||
}
|
||||
|
||||
auto IsCppConstructorOrNonMethodOperator(Context& context,
|
||||
SemIR::InstId inst_id) -> bool {
|
||||
auto IsCppConstructorOrNonMethod(Context& context, SemIR::InstId inst_id)
|
||||
-> bool {
|
||||
auto* function_decl = GetAsCppFunctionDecl(context, inst_id);
|
||||
if (!function_decl) {
|
||||
return false;
|
||||
@@ -754,8 +754,7 @@ auto IsCppConstructorOrNonMethodOperator(Context& context,
|
||||
if (isa<clang::CXXConstructorDecl>(function_decl)) {
|
||||
return true;
|
||||
}
|
||||
return !isa<clang::CXXMethodDecl>(function_decl) &&
|
||||
function_decl->isOverloadedOperator();
|
||||
return !isa<clang::CXXMethodDecl>(function_decl);
|
||||
}
|
||||
|
||||
} // namespace Carbon::Check
|
||||
|
||||
Reference in New Issue
Block a user