[cfe-commits] r43387 - in /cfe/trunk: CodeGen/CGExpr.cpp test/CodeGen/struct.c
Devang Patel
dpatel at apple.com
Fri Oct 26 11:15:21 PDT 2007
Author: dpatel
Date: Fri Oct 26 13:15:21 2007
New Revision: 43387
URL: http://llvm.org/viewvc/llvm-project?rev=43387&view=rev
Log:
Handle non LValue base expressions.
Modified:
cfe/trunk/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGen/struct.c
Modified: cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExpr.cpp?rev=43387&r1=43386&r2=43387&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Fri Oct 26 13:15:21 2007
@@ -394,21 +394,18 @@
}
llvm::Value *BaseValue = NULL;
- if (const CallExpr *CE = dyn_cast<CallExpr>(BaseExpr)) {
- RValue Base = EmitCallExpr(CE);
- BaseValue = Base.getScalarVal();
- }
- else {
+ if (BaseExpr->isLvalue() == Expr::LV_Valid) {
LValue BaseLV = EmitLValue(BaseExpr);
BaseValue = BaseLV.getAddress();
-
+
if (E->isArrow()) {
QualType PTy = cast<PointerType>(BaseExpr->getType())->getPointeeType();
BaseValue = Builder.CreateBitCast(BaseValue,
- llvm::PointerType::get(ConvertType(PTy)),
+ llvm::PointerType::get(ConvertType(PTy)),
"tmp");
}
- }
+ } else
+ BaseValue = EmitScalarExpr(BaseExpr);
FieldDecl *Field = E->getMemberDecl();
unsigned idx = CGM.getTypes().getLLVMFieldNo(Field);
Modified: cfe/trunk/test/CodeGen/struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct.c?rev=43387&r1=43386&r2=43387&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/struct.c (original)
+++ cfe/trunk/test/CodeGen/struct.c Fri Oct 26 13:15:21 2007
@@ -59,3 +59,7 @@
void f4() {
f3()->d1 = 42;
}
+
+void f5() {
+ (f3())->d1 = 42;
+}
More information about the cfe-commits
mailing list