[cfe-commits] r117159 - in /cfe/trunk: clang.xcodeproj/project.pbxproj lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprCXX.cpp lib/CodeGen/CGValue.h test/CodeGenCXX/stmtexpr-copy-init.cpp
Fariborz Jahanian
fjahanian at apple.com
Fri Oct 22 15:05:04 PDT 2010
Author: fjahanian
Date: Fri Oct 22 17:05:03 2010
New Revision: 117159
URL: http://llvm.org/viewvc/llvm-project?rev=117159&view=rev
Log:
After discussion with Doug and John, I am reverting
the patch.
Modified:
cfe/trunk/clang.xcodeproj/project.pbxproj
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CGValue.h
cfe/trunk/test/CodeGenCXX/stmtexpr-copy-init.cpp
Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=117159&r1=117158&r2=117159&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Fri Oct 22 17:05:03 2010
@@ -2039,7 +2039,6 @@
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
compatibilityVersion = "Xcode 2.4";
- developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=117159&r1=117158&r2=117159&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Oct 22 17:05:03 2010
@@ -147,23 +147,6 @@
/// represents a value lvalue, this method emits the address of the lvalue,
/// then loads the result into DestPtr.
void AggExprEmitter::EmitAggLoadOfLValue(const Expr *E) {
- if (CGF.getContext().getLangOptions().CPlusPlus) {
- if (const CXXConstructExpr *CE = Dest.getCtorExpr()) {
- // Perform copy initialization of Src into Dest.
- const CXXConstructorDecl *CD = CE->getConstructor();
- CXXCtorType Type =
- (CE->getConstructionKind() == CXXConstructExpr::CK_Complete)
- ? Ctor_Complete : Ctor_Base;
- bool ForVirtualBase =
- CE->getConstructionKind() == CXXConstructExpr::CK_VirtualBase;
- // Call the constructor.
- const Stmt * S = dyn_cast<Stmt>(E);
- clang::ConstExprIterator BegExp(&S);
- CGF.EmitCXXConstructorCall(CD, Type, ForVirtualBase, Dest.getAddr(),
- BegExp, (BegExp+1));
- return;
- }
- }
LValue LV = CGF.EmitLValue(E);
EmitFinalDestCopy(E, LV);
}
@@ -221,6 +204,7 @@
CGF.CGM.getLangOptions().CPlusPlus ||
(IgnoreResult && Ignore))
return;
+
// If the source is volatile, we must read from it; to do that, we need
// some place to put it.
Dest = CGF.CreateAggTemp(E->getType(), "agg.tmp");
@@ -238,7 +222,6 @@
SizeVal);
return;
}
-
// If the result of the assignment is used, copy the LHS there also.
// FIXME: Pass VolatileDest as well. I think we also need to merge volatile
// from the source as well, as we can't eliminate it if either operand
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=117159&r1=117158&r2=117159&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Fri Oct 22 17:05:03 2010
@@ -299,7 +299,6 @@
assert(getContext().hasSameUnqualifiedType(E->getType(),
E->getArg(0)->getType()));
if (E->getArg(0)->isTemporaryObject(getContext(), CD->getParent())) {
- Dest.setCtorExpr(const_cast<CXXConstructExpr*>(E));
EmitAggExpr(E->getArg(0), Dest);
return;
}
Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=117159&r1=117158&r2=117159&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Fri Oct 22 17:05:03 2010
@@ -26,7 +26,6 @@
namespace clang {
class ObjCPropertyRefExpr;
class ObjCImplicitSetterGetterRefExpr;
- class CXXConstructExpr;
namespace CodeGen {
class CGBitFieldInfo;
@@ -336,7 +335,6 @@
class AggValueSlot {
/// The address.
llvm::Value *Addr;
- CXXConstructExpr *CtorExpr;
// Associated flags.
bool VolatileFlag : 1;
@@ -349,7 +347,6 @@
static AggValueSlot ignored() {
AggValueSlot AV;
AV.Addr = 0;
- AV.CtorExpr = 0;
AV.VolatileFlag = AV.LifetimeFlag = AV.RequiresGCollection = 0;
return AV;
}
@@ -367,7 +364,6 @@
bool RequiresGCollection=false) {
AggValueSlot AV;
AV.Addr = Addr;
- AV.CtorExpr = 0;
AV.VolatileFlag = Volatile;
AV.LifetimeFlag = LifetimeExternallyManaged;
AV.RequiresGCollection = RequiresGCollection;
@@ -379,10 +375,7 @@
return forAddr(LV.getAddress(), LV.isVolatileQualified(),
LifetimeExternallyManaged, RequiresGCollection);
}
-
- void setCtorExpr(CXXConstructExpr *E) { CtorExpr = E; }
- CXXConstructExpr *getCtorExpr() const { return CtorExpr; }
-
+
bool isLifetimeExternallyManaged() const {
return LifetimeFlag;
}
Modified: cfe/trunk/test/CodeGenCXX/stmtexpr-copy-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/stmtexpr-copy-init.cpp?rev=117159&r1=117158&r2=117159&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/stmtexpr-copy-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/stmtexpr-copy-init.cpp Fri Oct 22 17:05:03 2010
@@ -1,26 +0,0 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
-// rdar //8540501
-
-struct A
-{
- int i;
- A (int j) : i(j) {}
- A (const A &j) : i(j.i) {}
- A& operator= (const A &j) { i = j.i; return *this; }
-};
-
-A foo(int j)
-{
- return ({ j ? A(1) : A(0); });
-}
-
-int main()
-{
- return foo(1).i-1;
-}
-
-void foo2()
-{
- A b = ({ A a(1); a; });
-}
-
More information about the cfe-commits
mailing list