[libcxx-commits] [PATCH] D97802: [libc++] Fix incorrect typeinfo comparison on ARM64

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 31 15:14:36 PDT 2021


ldionne added inline comments.


================
Comment at: libcxx/include/typeinfo:158-162
+// suffices to compare their addresses. Otherwise, if at least one of the
+// RTTIs can't be assumed to be unique, we must perform a deep string comparison
+// of the type names. Note that if one of the RTTIs is guaranteed unique and
+// the other one isn't, then both RTTIs are necessarily not to be considered
+// equal.
----------------
smeenai wrote:
> This reads a little confusingly, because the "Otherwise, if at least one of the RTTIs can't be assumed to be unique bit" makes you think that the case where on RTTI is unique and one isn't will do the deep string comparison, but then the next sentence changes the interpretation of that case. Maybe say "if both RTTIs can't be assumed to be unique", since the last sentence already handles the non-unique + unique case?
Actually, that isn't what I meant to write. I meant:

```
When comparing type_infos, if both RTTIs can be assumed to be unique, it suffices to compare their addresses. If both the RTTIs can't be assumed to be unique, we must perform a deep string comparison of the type names. However, if one of the RTTIs is guaranteed unique and the other one isn't, then both RTTIs are necessarily not to be considered equal.
```

Thanks for catching that!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97802



More information about the libcxx-commits mailing list