summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-02-13 21:18:23 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-02-13 21:18:23 +0000
commit2c5868c334646d4cdc92589cea393a5012cdd813 (patch)
treeac106767d283c9e5dc2c7204c7c179d48814faff /clang/lib/CodeGen/CodeGenFunction.h
parent6c95b97bf6fb2dc3ec1e36963742d952f5b3b30b (diff)
downloadbcm5719-llvm-2c5868c334646d4cdc92589cea393a5012cdd813.tar.gz
bcm5719-llvm-2c5868c334646d4cdc92589cea393a5012cdd813.zip
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. llvm-svn: 175078
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index ea5e8733d6f..e85c23e2172 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/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
OpenPOWER on IntegriCloud