diff gen/classes.cpp @ 123:7f9a0a58394b trunk

[svn r127] Updated the lphobos build scripts a little. Created a new rebuild profile. Removed some potentially very long logging lines. Added support for inner classes.
author lindquist
date Wed, 28 Nov 2007 03:01:51 +0100
parents 9c79b61fb638
children 1700239cab2e
line wrap: on
line diff
--- a/gen/classes.cpp	Tue Nov 27 09:19:07 2007 +0100
+++ b/gen/classes.cpp	Wed Nov 28 03:01:51 2007 +0100
@@ -131,12 +131,8 @@
     else
         *ts->llvmType = structtype;
 
-    if (cd->isNested()) {
-        assert(0 && "nested classes not implemented");
-    }
-    else {
-        gIR->module->addTypeName(cd->mangle(), ts->llvmType->get());
-    }
+    // name the type
+    gIR->module->addTypeName(cd->mangle(), ts->llvmType->get());
 
     // build interface info type
     std::vector<const llvm::Type*> infoTypes;
@@ -231,8 +227,8 @@
     gIR->classes.push_back(cd);
 
     bool needs_definition = false;
-    if (cd->parent->isModule()) {
-        needs_definition = (cd->getModule() == gIR->dmodule);
+    if (cd->getModule() == gIR->dmodule) {
+        needs_definition = true;
     }
 
     // interface vtables are emitted by the class implementing them
@@ -319,7 +315,7 @@
     DtoDeclareClassInfo(cd);
 
     // typeinfo
-    if (cd->parent->isModule() && cd->getModule() == gIR->dmodule)
+    if (needs_definition)
         cd->type->getTypeInfo(NULL);
 }
 
@@ -520,8 +516,7 @@
     assert(cd->type->ty == Tclass);
     TypeClass* ts = (TypeClass*)cd->type;
 
-    bool def = false;
-    if (cd->parent->isModule() && cd->getModule() == gIR->dmodule) {
+    if (cd->getModule() == gIR->dmodule) {
         // interfaces don't have initializers
         if (!cd->isInterfaceDeclaration()) {
             cd->llvmInit->setInitializer(cd->llvmConstInit);
@@ -542,11 +537,10 @@
                 irstruct->interfaceInfos->setInitializer(arrInit);
             }
         }
-        def = true;
+
+        // generate classinfo
+        DtoDefineClassInfo(cd);
     }
-
-    // generate classinfo
-    if (def) DtoDefineClassInfo(cd);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -752,7 +746,7 @@
     llvm::Constant* c = isaConstant(vd->type->vtinfo->llvmValue);
 
     const llvm::Type* tiTy = llvm::PointerType::get(Type::typeinfo->type->llvmType->get());
-    Logger::cout() << "tiTy = " << *tiTy << '\n';
+    //Logger::cout() << "tiTy = " << *tiTy << '\n';
 
     types.push_back(tiTy);
     inits.push_back(llvm::ConstantExpr::getBitCast(c, tiTy));