[cfe-commits] r45954 - in /cfe/trunk: CodeGen/CGExprAgg.cpp test/CodeGen/struct.c
Anders Carlsson
andersca at mac.com
Sun Jan 13 22:28:57 PST 2008
Author: andersca
Date: Mon Jan 14 00:28:57 2008
New Revision: 45954
URL: http://llvm.org/viewvc/llvm-project?rev=45954&view=rev
Log:
Add codegen upport for implicit casts to aggregate exprs.
Modified:
cfe/trunk/CodeGen/CGExprAgg.cpp
cfe/trunk/test/CodeGen/struct.c
Modified: cfe/trunk/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprAgg.cpp?rev=45954&r1=45953&r2=45954&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/CodeGen/CGExprAgg.cpp Mon Jan 14 00:28:57 2008
@@ -70,8 +70,8 @@
// Operators.
// case Expr::UnaryOperatorClass:
- // case Expr::ImplicitCastExprClass:
// case Expr::CastExprClass:
+ void VisitImplicitCastExpr(ImplicitCastExpr *E);
void VisitCallExpr(const CallExpr *E);
void VisitStmtExpr(const StmtExpr *E);
void VisitBinaryOperator(const BinaryOperator *BO);
@@ -137,6 +137,16 @@
// Visitor Methods
//===----------------------------------------------------------------------===//
+void AggExprEmitter::VisitImplicitCastExpr(ImplicitCastExpr *E)
+{
+ QualType STy = E->getSubExpr()->getType().getCanonicalType();
+ QualType Ty = E->getType().getCanonicalType();
+
+ assert(STy == Ty && "Implicit cast types must be equal");
+
+ Visit(E->getSubExpr());
+}
+
void AggExprEmitter::VisitCallExpr(const CallExpr *E)
{
RValue RV = CGF.EmitCallExpr(E);
Modified: cfe/trunk/test/CodeGen/struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct.c?rev=45954&r1=45953&r2=45954&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/struct.c (original)
+++ cfe/trunk/test/CodeGen/struct.c Mon Jan 14 00:28:57 2008
@@ -112,3 +112,18 @@
_Bool j,k;
} ws;
+
+/* Implicit casts (due to typedefs) */
+typedef struct _a
+{
+ int a;
+} a;
+
+void f11()
+{
+ struct _a a1;
+ a a2;
+
+ a1 = a2;
+ a2 = a1;
+}
More information about the cfe-commits
mailing list