[PATCH] D28212: typeinfo: provide a partial implementation for Win32

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 13:06:27 PDT 2017


smeenai added a comment.

@compnerd, @EricWF and I discussed this a bit on IRC yesterday.

My motivation here is that I'm using libc++ with other headers that clash badly with the vcruntime headers, which prevents me from using libc++'s `_LIBCPP_ABI_MICROSOFT` support. Reducing libc++'s dependencies on the vcruntime headers enables me to at least use parts of the Microsoft ABI support.

At the same time, @EricWF pointed out that most people will expect libc++ to play nicely with the vcruntime headers. In particular, `vcruntime_new.h` ends up getting pulled in from all sorts of places, which is why libc++ defers to that header instead of trying to provide its own new/delete declarations for `_LIBCPP_ABI_MICROSOFT`.

One option would be an alternate ABI configuration, which is basically "Microsoft ABI support without reliance on and interoperability with vcruntime headers". Another possibility would be for the libc++ headers to provide vcruntime-compatible declarations for `_LIBCPP_ABI_MICROSOFT`, which would allow us to remain compatible with the vcruntime headers without depending on them. I find the second option to be cleaner conceptually and would prefer it.

In this particular case, however, I don't believe those concerns apply. `vcruntime_typeinfo.h` is only pulled in from MSVC's `typeinfo` header, so it's not going to get pulled in unless explicitly requested, and therefore there are no interoperability concerns. Additionally, the `type_info` structure here is completely compatible with the one from the vcruntime headers, since they both model the Microsoft ABI typeinfo structure. The only behavior difference is that vcruntime's implementation will demangle the type name, whereas this one won't, but we can address that in a follow-up. In other words, I believe this change can go in independent of whatever decision we reach for vcruntime interoperability in the general case.


https://reviews.llvm.org/D28212





More information about the cfe-commits mailing list