brunodf-snps wrote: > Rebuilding a bunch of types to circumvent our own analysis... a bit weird. I > wonder if we could instead extract the parts of IsFunctionConversion() that > we care about here into a separate function.
The point of `IsFunctionConversion` is that is constantly rebuilding types to remove allowed mismatches between function signatures, all leading up to [a final type equality check](https://github.com/llvm/llvm-project/blob/cae73be8a6c2d39e5a827fd31848676d52062a94/clang/lib/Sema/SemaOverload.cpp#L2034-L2037) at the end that must succeed, and that verifies that "all the rest" matches up exactly. This organization is all or nothing and prevents to extract part of `IsFunctionConversion` to use here. The only remedy I can think of, is to entirely reimplement `IsFunctionConversion` without the type rebuilding and the final type equality check, and replace this by explicit checks on each and every part of the function signature. I've attempted this approach in brunodf-snps/llvm-project#1 (here I also extract the part that I need from `checkPointerTypesForAssignment` in a separate function `IsLegalExtInfoConversion`). This is not 100% complete, but it is quite clear that this brings much more logic into `IsFunctionConversion` and `IsLegalExtInfoConversion`. In particular, these functions need complete knowledge of all the bits of information in function signatures since we cannot rely on a blanket type equality check to check for an exact match on "all the rest" anymore. I really doubt if this alternate approach is the way to go. All in all, I think what I'm proposing here, to rebuild types in `checkPointerTypesForAssignment`, is in line with the way `IsFunctionConversion` is organized today (and thus not atypical) and this organization has reasonable tradeoffs. Let me know if you think different or see a better way out. > Adding some more reviewers for opinions Gentle ping, and tagging @AaronBallman as well. https://github.com/llvm/llvm-project/pull/160477 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
