diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-18 09:30:21 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-18 09:30:21 +0000 |
commit | 0ad23f7f860e27b8b9a889be665cfaea830503ce (patch) | |
tree | 5ea12b1605d15d100f73d1207e7c1d675c2cf42d /lib/ubsan/ubsan_type_hash.h | |
parent | 58f54555c2528f863e211a0679c2c423cfa55fb2 (diff) |
ubsan: Demangle class names, and be more informative when a reinterpret_cast
has got us to the wrong offset within an object.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@170423 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/ubsan_type_hash.h')
-rw-r--r-- | lib/ubsan/ubsan_type_hash.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ubsan/ubsan_type_hash.h b/lib/ubsan/ubsan_type_hash.h index dfaf32752..1c5355701 100644 --- a/lib/ubsan/ubsan_type_hash.h +++ b/lib/ubsan/ubsan_type_hash.h @@ -24,10 +24,11 @@ typedef uptr HashValue; class DynamicTypeInfo { const char *MostDerivedTypeName; sptr Offset; + const char *SubobjectTypeName; public: - DynamicTypeInfo(const char *MDTN, sptr Offset) - : MostDerivedTypeName(MDTN), Offset(Offset) {} + DynamicTypeInfo(const char *MDTN, sptr Offset, const char *STN) + : MostDerivedTypeName(MDTN), Offset(Offset), SubobjectTypeName(STN) {} /// Determine whether the object had a valid dynamic type. bool isValid() const { return MostDerivedTypeName; } @@ -35,6 +36,8 @@ public: const char *getMostDerivedTypeName() const { return MostDerivedTypeName; } /// Get the offset from the most-derived type to this base class. sptr getOffset() const { return Offset; } + /// Get the name of the most-derived type at the specified offset. + const char *getSubobjectTypeName() const { return SubobjectTypeName; } }; /// \brief Get information about the dynamic type of an object. |