Always compare C++ typeinfo (based on libstdc++ implementation).
authorMartin Liska <mliska@suse.cz>
Wed, 6 Mar 2019 08:36:50 +0000 (08:36 +0000)
committerMartin Liska <mliska@suse.cz>
Wed, 6 Mar 2019 08:36:50 +0000 (08:36 +0000)
Differential Revision: https://reviews.llvm.org/D58028

llvm-svn: 355488

compiler-rt/lib/sanitizer_common/sanitizer_platform.h
compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc

index ce3a84a..7ba080e 100644 (file)
 # define MSC_PREREQ(version) 0
 #endif
 
-#if defined(__arm64__) && SANITIZER_IOS
-# define SANITIZER_NON_UNIQUE_TYPEINFO 1
-#else
+#if SANITIZER_MAC && !(defined(__arm64__) && SANITIZER_IOS)
 # define SANITIZER_NON_UNIQUE_TYPEINFO 0
+#else
+# define SANITIZER_NON_UNIQUE_TYPEINFO 1
 #endif
 
 // On linux, some architectures had an ABI transition from 64-bit long double
index 6337d93..3d5e536 100644 (file)
@@ -118,6 +118,7 @@ static bool isDerivedFromAtOffset(const abi::__class_type_info *Derived,
                                   sptr Offset) {
   if (Derived->__type_name == Base->__type_name ||
       (SANITIZER_NON_UNIQUE_TYPEINFO &&
+       Derived->__type_name[0] != '*' &&
        !internal_strcmp(Derived->__type_name, Base->__type_name)))
     return Offset == 0;