summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-07-16 22:04:59 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-07-16 22:04:59 +0000
commit62a11a78c2616ce1fa3ef7b1a4bc3f42365cafb9 (patch)
treea43afe913d69df405e73d8b02fc75b14f28dfabd /lib/CodeGen/CGExprScalar.cpp
parent1cdad9e844173d3d7aaad05ce567343178d4dc89 (diff)
downloadclang-62a11a78c2616ce1fa3ef7b1a4bc3f42365cafb9.tar.gz
clang-62a11a78c2616ce1fa3ef7b1a4bc3f42365cafb9.tar.bz2
clang-62a11a78c2616ce1fa3ef7b1a4bc3f42365cafb9.tar.xz
ir-gen for --/++ operators of objc object pointers
in 32bit abi. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 0316116631..8103506c2f 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -690,7 +690,25 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
llvm::Constant *Inc =
VMContext.getConstantInt(llvm::Type::Int32Ty, AmountVal);
if (!isa<llvm::FunctionType>(PT->getElementType())) {
- NextVal = Builder.CreateGEP(InVal, Inc, "ptrincdec");
+ QualType PTEE = ValTy->getPointeeType();
+ if (const ObjCInterfaceType *OIT =
+ dyn_cast<ObjCInterfaceType>(PTEE)) {
+ // Handle interface types, which are not represented with a concrete type.
+ int size = CGF.getContext().getTypeSize(OIT) / 8;
+ if (!isInc)
+ size = -size;
+ Inc = VMContext.getConstantInt(Inc->getType(), size);
+ const llvm::Type *i8Ty =
+ VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+ InVal = Builder.CreateBitCast(InVal, i8Ty);
+ NextVal = Builder.CreateGEP(InVal, Inc, "add.ptr");
+ llvm::Value *lhs = LV.getAddress();
+ lhs = Builder.CreateBitCast(lhs, VMContext.getPointerTypeUnqual(i8Ty));
+ LV = LValue::MakeAddr(lhs, ValTy.getCVRQualifiers(),
+ CGF.getContext().getObjCGCAttrKind(ValTy));
+ }
+ else
+ NextVal = Builder.CreateGEP(InVal, Inc, "ptrincdec");
} else {
const llvm::Type *i8Ty =
VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);