diff options
| author | John McCall <rjmccall@apple.com> | 2010-12-04 03:47:34 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-12-04 03:47:34 +0000 |
| commit | 34376a68c414ccf372e9d83f3251ecb08eb055f2 (patch) | |
| tree | 336b12526893f3694b8cb5654fef621818daca81 /clang/lib/CodeGen/CGExprAgg.cpp | |
| parent | 1c8ac8f027d4a7af830e91513f37a2139c684f19 (diff) | |
| download | llvm-34376a68c414ccf372e9d83f3251ecb08eb055f2.zip llvm-34376a68c414ccf372e9d83f3251ecb08eb055f2.tar.gz llvm-34376a68c414ccf372e9d83f3251ecb08eb055f2.tar.bz2 | |
Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ. So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.
In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.
This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.
Ted Kremenek kindly contributed the analyzer workarounds in this patch.
llvm-svn: 120890
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 9e4e7dc..b2679a3 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -282,8 +282,16 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) { break; } + case CK_GetObjCProperty: { + LValue LV = CGF.EmitLValue(E->getSubExpr()); + assert(LV.isPropertyRef()); + RValue RV = CGF.EmitLoadOfPropertyRefLValue(LV, getReturnValueSlot()); + EmitGCMove(E, RV); + break; + } + + case CK_LValueToRValue: // hope for downstream optimization case CK_NoOp: - case CK_LValueToRValue: case CK_UserDefinedConversion: case CK_ConstructorConversion: assert(CGF.getContext().hasSameUnqualifiedType(E->getSubExpr()->getType(), @@ -349,9 +357,8 @@ void AggExprEmitter::VisitObjCMessageExpr(ObjCMessageExpr *E) { } void AggExprEmitter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { - RValue RV = CGF.EmitLoadOfPropertyRefLValue(CGF.EmitObjCPropertyRefLValue(E), - getReturnValueSlot()); - EmitGCMove(E, RV); + llvm_unreachable("direct property access not surrounded by " + "lvalue-to-rvalue cast"); } void AggExprEmitter::VisitBinComma(const BinaryOperator *E) { |
