summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-01-14 02:49:48 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-01-14 02:49:48 +0000
commit574975efa99e387ba23cc2e0157141f83f387e0b (patch)
treeb590b0c369e996725a2f7a2d998412ede60a9423 /clang/lib/CodeGen/CGExpr.cpp
parenta6b2c4f721f4243d4b39f1ab02bbdc986002afdc (diff)
downloadbcm5719-llvm-574975efa99e387ba23cc2e0157141f83f387e0b.tar.gz
bcm5719-llvm-574975efa99e387ba23cc2e0157141f83f387e0b.zip
CodeGen: Only emit CFI unrelated cast checks for bit casts.
We were previously emitting them for no-op casts (e.g. implicit casts to const). llvm-svn: 257738
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 507ce3d7d0c..e918cd81f0b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -824,7 +824,8 @@ Address CodeGenFunction::EmitPointerWithAlignment(const Expr *E,
getNaturalPointeeTypeAlignment(E->getType(), Source));
}
- if (SanOpts.has(SanitizerKind::CFIUnrelatedCast)) {
+ if (SanOpts.has(SanitizerKind::CFIUnrelatedCast) &&
+ CE->getCastKind() == CK_BitCast) {
if (auto PT = E->getType()->getAs<PointerType>())
EmitVTablePtrCheckForCast(PT->getPointeeType(), Addr.getPointer(),
/*MayBeNull=*/true,
OpenPOWER on IntegriCloud