From c8317a44cf535253a5653526ce46ed8ebddbff7e Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 23 Aug 2008 10:51:21 +0000 Subject: Implement Obj-C ivar references to aggregates. Implement Obj-C lvalue message sends (aggregate returns). Update several places to emit more precise ErrorUnsupported warnings for currently unimplemented Obj-C features (main missing chunks are property references, Obj-C exception handling, and the for ... in syntax). llvm-svn: 55234 --- clang/lib/CodeGen/CGExpr.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'clang/lib/CodeGen/CGExpr.cpp') diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index f0c056faddee..a191610d1f54 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -104,8 +104,17 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { case Expr::StringLiteralClass: return EmitStringLiteralLValue(cast(E)); + case Expr::ObjCMessageExprClass: + return EmitObjCMessageExprLValue(cast(E)); case Expr::ObjCIvarRefExprClass: return EmitObjCIvarRefLValue(cast(E)); + case Expr::ObjCPropertyRefExprClass: { + // FIXME: Implement! + ErrorUnsupported(E, "l-value expression (Objective-C property reference)"); + llvm::Type *Ty = llvm::PointerType::getUnqual(ConvertType(E->getType())); + return LValue::MakeAddr(llvm::UndefValue::get(Ty), + E->getType().getCVRQualifiers()); + } case Expr::UnaryOperatorClass: return EmitUnaryOpLValue(cast(E)); @@ -734,6 +743,14 @@ LValue CodeGenFunction::EmitCallExprLValue(const CallExpr *E) { E->getType().getCVRQualifiers()); } +LValue CodeGenFunction::EmitObjCMessageExprLValue(const ObjCMessageExpr *E) { + // Can only get l-value for message expression returning aggregate type + RValue RV = EmitObjCMessageExpr(E); + // FIXME: can this be volatile? + return LValue::MakeAddr(RV.getAggregateAddr(), + E->getType().getCVRQualifiers()); +} + LValue CodeGenFunction::EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E) { // Objective-C objects are traditionally C structures with their layout // defined at compile-time. In some implementations, their layout is not -- cgit v1.2.3