comparison gen/classes.cpp @ 268:23d0d9855cad trunk

[svn r289] Fixed: right shift >> was broken for unsigned types. Fixed: debug info for classes now started.
author lindquist
date Sun, 15 Jun 2008 18:52:27 +0200
parents a95056b3c996
children 1e6e2b5d5bfe
comparison
equal deleted inserted replaced
267:c43911baea21 268:23d0d9855cad
1325 return DtoConstSlice(size, ptr); 1325 return DtoConstSlice(size, ptr);
1326 } 1326 }
1327 1327
1328 static LLConstant* build_class_dtor(ClassDeclaration* cd) 1328 static LLConstant* build_class_dtor(ClassDeclaration* cd)
1329 { 1329 {
1330 #if 0
1330 // construct the function 1331 // construct the function
1331 std::vector<const LLType*> paramTypes; 1332 std::vector<const LLType*> paramTypes;
1332 paramTypes.push_back(getPtrToType(cd->type->ir.type->get())); 1333 paramTypes.push_back(getPtrToType(cd->type->ir.type->get()));
1333 1334
1334 const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::VoidTy, paramTypes, false); 1335 const llvm::FunctionType* fnTy = llvm::FunctionType::get(LLType::VoidTy, paramTypes, false);
1362 builder.CreateCall(d->ir.irFunc->func, thisptr); 1363 builder.CreateCall(d->ir.irFunc->func, thisptr);
1363 } 1364 }
1364 builder.CreateRetVoid(); 1365 builder.CreateRetVoid();
1365 1366
1366 return llvm::ConstantExpr::getBitCast(func, getPtrToType(LLType::Int8Ty)); 1367 return llvm::ConstantExpr::getBitCast(func, getPtrToType(LLType::Int8Ty));
1368 #else
1369
1370 FuncDeclaration* dtor = cd->dtor;
1371
1372 // if no destructor emit a null
1373 if (!dtor)
1374 return getNullPtr(getVoidPtrType());
1375
1376 DtoForceDeclareDsymbol(dtor);
1377 return llvm::ConstantExpr::getBitCast(dtor->ir.irFunc->func, getPtrToType(LLType::Int8Ty));
1378 #endif
1367 } 1379 }
1368 1380
1369 static uint build_classinfo_flags(ClassDeclaration* cd) 1381 static uint build_classinfo_flags(ClassDeclaration* cd)
1370 { 1382 {
1371 // adapted from original dmd code 1383 // adapted from original dmd code