[PATCH] D157452: [RFC][Clang][Codegen] `std::type_info` needs special care with explicit address spaces

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 14:54:33 PDT 2023


rjmccall added a comment.

The path of least resistance here is that IRGen should just insert conversions from the global AS to the default AS as part of evaluating `typeid`.  I haven't looked at it closely, but that seems to be what this patch is doing.

However, `std::type_info` is an interesting special case in that we actually know statically that all objects of that type will be allocated in the global AS, so there's really no reason to pass around pointers in the default AS; `std::type_info *` should just default to being in the global AS.  It'd be a non-trivial feature in supported of a somewhat uncommonly-used C++ feature, and I can't tell how best to spend your time, *but*... if you're so inclined, I think it would make a somewhat compelling feature to be able to declare a default AS for a class type, which your target could then adopt in the C++ std headers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157452/new/

https://reviews.llvm.org/D157452



More information about the cfe-commits mailing list