[libcxx-dev] Non-merged type info name comparison

Shoaib Meenai via libcxx-dev libcxx-dev at lists.llvm.org
Fri May 15 15:18:01 PDT 2020


One thing I’ve since discovered is that clang doesn’t produce the leading * for anonymous namespace types either, so that would be the other half of such a change. See https://llvm.org/PR34907


From: Louis Dionne <ldionne at apple.com>
Date: Thursday, May 14, 2020 at 5:59 AM
To: Shoaib Meenai <smeenai at fb.com>, Eric Fiselier <ericwf at google.com>
Cc: "libcxx-dev at lists.llvm.org" <libcxx-dev at lists.llvm.org>
Subject: Re: [libcxx-dev] Non-merged type info name comparison

Revisiting this, I think it would make sense to do that. The three modes would become:

1) Unique: Assume RTTI is de-duplicated, and only ever compare pointers -- AS-IS TODAY
2) NonUnique: Assume RTTI is not de-deduplicated: compare pointers first, fall back to string comparison but not when it starts with * -- THIS IS DIFFERENT FROM TODAY
3) NonUniqueARMRTTIBit: Weird implementation for ARM64 -- DOESN'T CHANGE

Eric, what do you think? It would be straightforward to implement, and it would unbreak the NonUnique variant in the cases where we have identically named types in anonymous namespaces -- an arguable bug in the NonUnique implementation today.

Louis


On Sep 23, 2019, at 15:02, Shoaib Meenai via libcxx-dev <libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>> wrote:

In https://reviews.llvm.org/rL361913<https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_rL361913&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=_CncFX8flnXZAyUtjXRdGlfdWLjd9ENI8NmtbZ8khig&s=-niuKHWY_4JqFnEcc6SCTpTACfoEyMqpi3uzzAshu3E&e=>, libc++ gained the option to make type info comparisons use a strcmp on the type info name, which is useful for when we can’t guarantee RTTI uniqueness. I believe libstdc++ also defaults to strcmp comparisons. However, libstdc++ doesn’t perform the string comparison when the type info name begins with the * character [1], which is the case for e.g. types defined in anonymous namespaces. Should libc++’s implementation be changed to match, at least when targeting Linux?

[1] https://github.com/gcc-mirror/gcc/blob/277b02e227df91c686e7f7ad1ae21cd898611ca8/libstdc%2B%2B-v3/libsupc%2B%2B/typeinfo#L123

_______________________________________________
libcxx-dev mailing list
libcxx-dev at lists.llvm.org<mailto:libcxx-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=_CncFX8flnXZAyUtjXRdGlfdWLjd9ENI8NmtbZ8khig&s=0QB244cb5snVBKHVYeKGL9YBf8YbYvHTZh2x86EKhXQ&e=>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20200515/dc1cbb53/attachment.html>


More information about the libcxx-dev mailing list