[clang] [clang-tools-extra] [Clang] Use TargetInfo when deciding is an address space is compatible (PR #115777)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 14:46:51 PST 2024


jhuber6 wrote:

> Address spaces from language dialects generally have required relationships and behaviors in the language, and that really shouldn't be overridden by targets. However, targets do need to be able to decide how target-specific address spaces work, including how they interact with language address spaces. We can square this circle in two ways that I can see. The first is that we could only defer to the `TargetInfo` when at least one of the address spaces is a target AS. The second is by having the default implementation implement the standard language rules and just expecting that the target will know to defer to it when its target address spaces aren't involved. I don't particularly care which way we go.

This is pretty much what I've got now, we only check the target specific address spaces in the target info, so the languages should be unaffected.
 
> It seems to me that the AST-level comparison routines ought to take an `ASTContext &` instead of the TI directly, though.

I can make that change, might make it easier to expand in the future.

https://github.com/llvm/llvm-project/pull/115777


More information about the cfe-commits mailing list