summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorAmy Huang <akhuang@google.com>2019-05-02 20:07:35 +0000
committerAmy Huang <akhuang@google.com>2019-05-02 20:07:35 +0000
commit301a5bbd59df75bc4ae40328f717c5ad4efabfff (patch)
tree5e1413877b0b5c8c37d90b700a6f7f98a4cabacd /clang/lib/CodeGen/CGExprScalar.cpp
parent8ccb8f86474af26497be8cf7ffd46bd11f5e7b0f (diff)
Change the metadata for heapallocsite calls when the type is cast.
llvm-svn: 359823
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 83e9349492a0..777e1dc89389 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2063,6 +2063,12 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
}
}
+ // Update heapallocsite metadata when there is an explicit cast.
+ if (llvm::CallInst *CI = dyn_cast<llvm::CallInst>(Src))
+ if (CI->getMetadata("heapallocsite") && isa<ExplicitCastExpr>(CE))
+ CGF.getDebugInfo()->
+ addHeapAllocSiteMetadata(CI, CE->getType(), CE->getExprLoc());
+
return Builder.CreateBitCast(Src, DstTy);
}
case CK_AddressSpaceConversion: {