mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-25 07:32:36 +00: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:
1 parent
e6b1679552
commit
64e890c246
5 files changed
+1466
-153
No files matched your search
@@ -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