From 755d8497e39071aa24acc173ff07083e3256b8f8 Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 12 Apr 2011 00:42:48 +0000 Subject: After some discussion with Doug, we decided that it made a lot more sense for __unknown_anytype resolution to destructively modify the AST. So that's what it does now, which significantly simplifies some of the implementation. Normal member calls work pretty cleanly now, and I added support for propagating unknown-ness through &. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129331 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 496c3fc0aa..92e6a19c25 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1792,35 +1792,6 @@ EmitConditionalOperatorLValue(const AbstractConditionalOperator *expr) { return MakeAddrLValue(phi, expr->getType()); } -static LValue emitUnknownAnyLValue(CodeGenFunction &CGF, - const Expr *operand, - QualType resolvedType) { - const ValueDecl *decl; - if (const DeclRefExpr *ref = dyn_cast(operand)) { - decl = ref->getDecl(); - } else if (const MemberExpr *mem = dyn_cast(operand)) { - decl = mem->getMemberDecl(); - - // Emit (and ignore) the base. - if (mem->isArrow()) - CGF.EmitScalarExpr(mem->getBase()); - else - CGF.EmitLValue(mem->getBase()); - } else { - llvm_unreachable("unexpected operand of unknown-any resolution!"); - decl = 0; - } - llvm::Value *addr = CGF.CGM.getAddrOfUnknownAnyDecl(decl, resolvedType); - - QualType type = resolvedType; - if (const ReferenceType *ref = type->getAs()) { - addr = CGF.Builder.CreateLoad(addr, "ref.value"); - type = ref->getPointeeType(); - } - - return CGF.MakeAddrLValue(addr, type); -} - /// EmitCastLValue - Casts are never lvalues unless that cast is a dynamic_cast. /// If the cast is a dynamic_cast, we can have the usual lvalue result, /// otherwise if a cast is needed by the code generator in an lvalue context, @@ -1959,13 +1930,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { ConvertType(ToType)); return MakeAddrLValue(V, E->getType()); } - case CK_ResolveUnknownAnyType: - return emitUnknownAnyLValue(*this, E->getSubExpr(), E->getType()); - case CK_ResolveUnknownAnyTypeToReference: { - // l-value vs. r-value reference type shouldn't matter here. - QualType type = getContext().getLValueReferenceType(E->getType()); - return emitUnknownAnyLValue(*this, E->getSubExpr(), type); - } } llvm_unreachable("Unhandled lvalue cast kind?"); -- cgit v1.2.3