[cfe-commits] r95389 - in /cfe/trunk: lib/CodeGen/CGExprConstant.cpp test/CodeGenCXX/global-init.cpp

Douglas Gregor dgregor at apple.com
Fri Feb 5 08:18:09 PST 2010


Author: dgregor
Date: Fri Feb  5 10:18:08 2010
New Revision: 95389

URL: http://llvm.org/viewvc/llvm-project?rev=95389&view=rev
Log:
Revert r95363 and r95375, which broke self-host.

Modified:
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp
    cfe/trunk/test/CodeGenCXX/global-init.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=95389&r1=95388&r2=95389&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Fri Feb  5 10:18:08 2010
@@ -675,19 +675,9 @@
     if (!E->getConstructor()->isTrivial())
       return 0;
 
-    // FIXME: We should not have to call getBaseElementType here.
-    QualType Ty = CGM.getContext().getBaseElementType(E->getType());
-
-    const CXXRecordDecl *RD = 
-      cast<CXXRecordDecl>(Ty->getAs<RecordType>()->getDecl());
-    
-    // If the class doesn't have a trivial destructor, we can't emit it as a
-    // constant expr.
-    if (!RD->hasTrivialDestructor())
-      return 0;
-    
     // Only copy and default constructors can be trivial.
 
+    QualType Ty = E->getType();
 
     if (E->getNumArgs()) {
       assert(E->getNumArgs() == 1 && "trivial ctor with > 1 argument");

Modified: cfe/trunk/test/CodeGenCXX/global-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-init.cpp?rev=95389&r1=95388&r2=95389&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/global-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/global-init.cpp Fri Feb  5 10:18:08 2010
@@ -9,8 +9,6 @@
 
 struct C { void *field; };
 
-struct D { ~D(); };
-
 // CHECK: @c = global %struct.C zeroinitializer, align 8
 
 // CHECK: call void @_ZN1AC1Ev(%struct.A* @a)
@@ -25,7 +23,4 @@
 // CHECK-NOT: call void @_ZN1CC1Ev(%struct.C* @c)
 C c;
 
-// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1DD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @d, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
-D d;
-
 // CHECK: define internal void @__cxx_global_initialization() {





More information about the cfe-commits mailing list