diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-13 21:18:23 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-13 21:18:23 +0000 |
commit | c764830bdb6de82baed068889096bd3e52d4cbda (patch) | |
tree | 73a7173f5bd2dcbb43b3950276f7e8f429a39a17 /lib/CodeGen/CodeGenFunction.h | |
parent | a03ab10f0e4d888139b3b694dd55d176982f72a4 (diff) |
ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
base-to-derived casts have undefined behavior if the object is not actually an
instance of the derived type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index ea5e8733d6..e85c23e217 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -1895,7 +1895,13 @@ public: /// Must be an object within its lifetime. TCK_MemberCall, /// Checking the 'this' pointer for a constructor call. - TCK_ConstructorCall + TCK_ConstructorCall, + /// Checking the operand of a static_cast to a derived pointer type. Must be + /// null or an object within its lifetime. + TCK_DowncastPointer, + /// Checking the operand of a static_cast to a derived reference type. Must + /// be an object within its lifetime. + TCK_DowncastReference }; /// \brief Emit a check that \p V is the address of storage of the |