mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-26 00:23:14 +01:00
[svn r94] started on complex support
calling final class methods was being treated as a virtual call failing an assertion.
This commit is contained in:
@@ -233,6 +233,8 @@ struct ComplexExp : Expression
|
||||
#endif
|
||||
elem *toElem(IRState *irs);
|
||||
dt_t **toDt(dt_t **pdt);
|
||||
// LLVMDC
|
||||
virtual llvm::Constant *toConstElem(IRState *irs);
|
||||
};
|
||||
|
||||
struct IdentifierExp : Expression
|
||||
|
||||
23
gen/toir.cpp
23
gen/toir.cpp
@@ -318,6 +318,24 @@ llvm::Constant* NullExp::toConstElem(IRState* p)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DValue* ComplexExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ComplexExp::toElem(): %s | %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
llvm::Constant* ComplexExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("ComplexExp::toConstElem(): %s | %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DValue* StringExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("StringExp::toElem: %s | %s\n", toChars(), type->toChars());
|
||||
@@ -1631,7 +1649,7 @@ DValue* DotVarExp::toElem(IRState* p)
|
||||
unsigned cc = (unsigned)-1;
|
||||
|
||||
// virtual call
|
||||
if (fdecl->isVirtual()) {
|
||||
if (!fdecl->isFinal() && fdecl->isVirtual()) {
|
||||
assert(fdecl->vtblIndex > 0);
|
||||
assert(e1type->ty == Tclass);
|
||||
|
||||
@@ -2858,7 +2876,7 @@ STUB(ScopeExp);
|
||||
|
||||
STUB(TypeExp);
|
||||
//STUB(RealExp);
|
||||
STUB(ComplexExp);
|
||||
//STUB(ComplexExp);
|
||||
//STUB(StringExp);
|
||||
//STUB(IntegerExp);
|
||||
STUB(BoolExp);
|
||||
@@ -2885,6 +2903,7 @@ CONSTSTUB(Expression);
|
||||
//CONSTSTUB(IntegerExp);
|
||||
//CONSTSTUB(RealExp);
|
||||
//CONSTSTUB(NullExp);
|
||||
//CONSTSTUB(ComplexExp);
|
||||
//CONSTSTUB(StringExp);
|
||||
//CONSTSTUB(VarExp);
|
||||
//CONSTSTUB(ArrayLiteralExp);
|
||||
|
||||
@@ -69,9 +69,10 @@ const llvm::Type* DtoType(Type* t)
|
||||
|
||||
// complex
|
||||
case Tcomplex32:
|
||||
return DtoComplexType(llvm::Type::FloatTy);
|
||||
case Tcomplex64:
|
||||
case Tcomplex80:
|
||||
assert(0 && "complex number types not yet implemented");
|
||||
return DtoComplexType(llvm::Type::DoubleTy);
|
||||
|
||||
// pointers
|
||||
case Tpointer: {
|
||||
@@ -376,6 +377,16 @@ const llvm::StructType* DtoDelegateType(Type* t)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const llvm::StructType* DtoComplexType(const llvm::Type* base)
|
||||
{
|
||||
std::vector<const llvm::Type*> types;
|
||||
types.push_back(base);
|
||||
types.push_back(base);
|
||||
return llvm::StructType::get(types);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static llvm::Function* LLVM_DeclareMemIntrinsic(const char* name, int bits, bool set=false)
|
||||
{
|
||||
assert(bits == 32 || bits == 64);
|
||||
|
||||
@@ -26,6 +26,8 @@ llvm::Value* DtoBoolean(llvm::Value* val);
|
||||
|
||||
const llvm::Type* DtoSize_t();
|
||||
|
||||
const llvm::StructType* DtoComplexType(const llvm::Type* base);
|
||||
|
||||
void DtoMain();
|
||||
|
||||
void DtoCallClassDtors(TypeClass* tc, llvm::Value* instance);
|
||||
|
||||
6
test/bug53.d
Normal file
6
test/bug53.d
Normal file
@@ -0,0 +1,6 @@
|
||||
module bug53;
|
||||
class Foo {
|
||||
final void bar() {}
|
||||
void test() { bar(); }
|
||||
}
|
||||
void main() {}
|
||||
10
test/classinfo1.d
Normal file
10
test/classinfo1.d
Normal file
@@ -0,0 +1,10 @@
|
||||
module classinfo1;
|
||||
|
||||
class C
|
||||
{
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto ci = C.classinfo;
|
||||
}
|
||||
6
test/complex1.d
Normal file
6
test/complex1.d
Normal file
@@ -0,0 +1,6 @@
|
||||
module complex1;
|
||||
|
||||
void main()
|
||||
{
|
||||
cfloat c1;
|
||||
}
|
||||
Reference in New Issue
Block a user