diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-01-14 02:49:48 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-01-14 02:49:48 +0000 |
commit | 574975efa99e387ba23cc2e0157141f83f387e0b (patch) | |
tree | b590b0c369e996725a2f7a2d998412ede60a9423 /clang/lib/CodeGen/CGExpr.cpp | |
parent | a6b2c4f721f4243d4b39f1ab02bbdc986002afdc (diff) | |
download | bcm5719-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.cpp | 3 |
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, |