summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-09-09 20:57:59 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-09-09 20:57:59 +0000
commit22ee1a7466ca57ecbab2af5469e95fcf11e91232 (patch)
tree3d4770a384b5f37f2b0cdbee6c4f8be29437731d /clang/lib/CodeGen
parent5e0668426c564666d25d6cc91506200a85aa30da (diff)
downloadbcm5719-llvm-22ee1a7466ca57ecbab2af5469e95fcf11e91232.tar.gz
bcm5719-llvm-22ee1a7466ca57ecbab2af5469e95fcf11e91232.zip
[MS ABI] Don't crash on references to pointers to members in args
We know that a reference can always be dereferenced. However, we don't always know the number of bytes if the reference's pointee type is incomplete. This case was correctly handled but we didn't consider the case where the type is complete but we cannot calculate its size for ABI specific reasons. In this specific case, a member pointer's size is available only under certain conditions. This fixes PR24703. llvm-svn: 247188
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index ef9095291cd..b54264b5054 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1586,7 +1586,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
if (const auto *RefTy = RetTy->getAs<ReferenceType>()) {
QualType PTy = RefTy->getPointeeType();
- if (!PTy->isIncompleteType() && PTy->isConstantSizeType())
+ if (getCXXABI().isTypeInfoCalculable(PTy) && PTy->isConstantSizeType())
RetAttrs.addDereferenceableAttr(getContext().getTypeSizeInChars(PTy)
.getQuantity());
else if (getContext().getTargetAddressSpace(PTy) == 0)
@@ -1698,7 +1698,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
if (const auto *RefTy = ParamType->getAs<ReferenceType>()) {
QualType PTy = RefTy->getPointeeType();
- if (!PTy->isIncompleteType() && PTy->isConstantSizeType())
+ if (getCXXABI().isTypeInfoCalculable(PTy) && PTy->isConstantSizeType())
Attrs.addDereferenceableAttr(getContext().getTypeSizeInChars(PTy)
.getQuantity());
else if (getContext().getTargetAddressSpace(PTy) == 0)
OpenPOWER on IntegriCloud