[cfe-commits] r46944 - /cfe/trunk/CodeGen/CGExprAgg.cpp
Eli Friedman
eli.friedman at gmail.com
Sun Feb 10 17:09:17 PST 2008
Author: efriedma
Date: Sun Feb 10 19:09:17 2008
New Revision: 46944
URL: http://llvm.org/viewvc/llvm-project?rev=46944&view=rev
Log:
A couple of minor fixes to aggregate codegen, to stop asserting on some
edge cases.
Modified:
cfe/trunk/CodeGen/CGExprAgg.cpp
Modified: cfe/trunk/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprAgg.cpp?rev=46944&r1=46943&r2=46944&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/CodeGen/CGExprAgg.cpp Sun Feb 10 19:09:17 2008
@@ -142,8 +142,10 @@
{
QualType STy = E->getSubExpr()->getType().getCanonicalType();
QualType Ty = E->getType().getCanonicalType();
-
- assert(STy.getUnqualifiedType() == Ty && "Implicit cast types must be equal");
+
+ assert(CGF.getContext().typesAreCompatible(
+ STy.getUnqualifiedType(), Ty.getUnqualifiedType())
+ && "Implicit cast types must be compatible");
Visit(E->getSubExpr());
}
@@ -184,17 +186,22 @@
}
void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
- assert(E->getLHS()->getType().getCanonicalType() ==
- E->getRHS()->getType().getCanonicalType() && "Invalid assignment");
+ // For an assignment to work, the value on the right has
+ // to be compatible with the value on the left.
+ assert(CGF.getContext().typesAreCompatible(
+ E->getLHS()->getType().getUnqualifiedType(),
+ E->getRHS()->getType().getUnqualifiedType())
+ && "Invalid assignment");
LValue LHS = CGF.EmitLValue(E->getLHS());
// Codegen the RHS so that it stores directly into the LHS.
CGF.EmitAggExpr(E->getRHS(), LHS.getAddress(), false /*FIXME: VOLATILE LHS*/);
+ if (DestPtr == 0)
+ return;
+
// If the result of the assignment is used, copy the RHS there also.
- if (DestPtr) {
- assert(0 && "FIXME: Chained agg assignment not implemented yet");
- }
+ EmitAggregateCopy(DestPtr, LHS.getAddress(), E->getType());
}
void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) {
More information about the cfe-commits
mailing list