]> granicus.if.org Git - clang/commitdiff
Revert r95363 and r95375, which broke self-host.
authorDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 16:18:08 +0000 (16:18 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 16:18:08 +0000 (16:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95389 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprConstant.cpp
test/CodeGenCXX/global-init.cpp

index a2073e66738f3b45bb727bfb352ab3de6d74934d..a358b54fa3c6ede71630500b1d0176351db6bf2d 100644 (file)
@@ -675,19 +675,9 @@ public:
     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");
index b60e056d708f4376be2333fbec3e5e346ecbcc13..fd8c1597556b8a23a076bf6dac389e17a5632add 100644 (file)
@@ -9,8 +9,6 @@ struct B { B(); ~B(); };
 
 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 @@ B b;
 // 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() {