aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-18 06:31:45 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-18 06:31:45 +0000
commitf89e55ab1bfb3ea997f8b02997c611a02254eb2d (patch)
treecacb763638dfa30e56adfe71a8ab73cd8b19eb64 /lib/CodeGen/CGBlocks.cpp
parent6a02b609c2e23b28d24f9db4c8006137c6b55ae4 (diff)
Calculate the value kind of an expression when it's created and
store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r--lib/CodeGen/CGBlocks.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index c40cfaf6a9..8f3e0a6326 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -161,7 +161,7 @@ static void AllocateAllBlockDeclRefs(CodeGenFunction &CGF, CGBlockInfo &Info) {
if (Info.NeedsObjCSelf) {
ValueDecl *Self = cast<ObjCMethodDecl>(CGF.CurFuncDecl)->getSelfDecl();
BlockDeclRefExpr *BDRE =
- new (CGF.getContext()) BlockDeclRefExpr(Self, Self->getType(),
+ new (CGF.getContext()) BlockDeclRefExpr(Self, Self->getType(), VK_RValue,
SourceLocation(), false);
Info.DeclRefs.push_back(BDRE);
CGF.AllocateBlockDecl(BDRE);
@@ -344,26 +344,26 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
if (BDRE->getCopyConstructorExpr()) {
E = BDRE->getCopyConstructorExpr();
PushDestructorCleanup(E->getType(), Addr);
- }
- else {
- E = new (getContext()) DeclRefExpr(const_cast<ValueDecl*>(VD),
- VD->getType().getNonReferenceType(),
- SourceLocation());
- if (VD->getType()->isReferenceType()) {
- E = new (getContext())
- UnaryOperator(const_cast<Expr*>(E), UO_AddrOf,
- getContext().getPointerType(E->getType()),
- SourceLocation());
- }
+ } else {
+ E = new (getContext()) DeclRefExpr(const_cast<ValueDecl*>(VD),
+ VD->getType().getNonReferenceType(),
+ Expr::getValueKindForType(VD->getType()),
+ SourceLocation());
+ if (VD->getType()->isReferenceType()) {
+ E = new (getContext())
+ UnaryOperator(const_cast<Expr*>(E), UO_AddrOf,
+ getContext().getPointerType(E->getType()),
+ VK_RValue, OK_Ordinary, SourceLocation());
}
}
}
+ }
if (BDRE->isByRef()) {
E = new (getContext())
UnaryOperator(const_cast<Expr*>(E), UO_AddrOf,
getContext().getPointerType(E->getType()),
- SourceLocation());
+ VK_RValue, OK_Ordinary, SourceLocation());
}
RValue r = EmitAnyExpr(E, AggValueSlot::forAddr(Addr, false, true));
@@ -932,7 +932,7 @@ CharUnits BlockFunction::getBlockOffset(CharUnits Size, CharUnits Align) {
0, QualType(PadTy), 0,
SC_None, SC_None);
Expr *E = new (getContext()) DeclRefExpr(PadDecl, PadDecl->getType(),
- SourceLocation());
+ VK_LValue, SourceLocation());
BlockLayout.push_back(E);
}