mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-07-22 07:05:22 +02:00
[svn r209] Fixed: exotic array to pointer casts were broken.
Changed: classes now have opaque vtables.
This commit is contained in:
@@ -4,7 +4,11 @@
|
||||
#include "ir/irstruct.h"
|
||||
#include "gen/irstate.h"
|
||||
|
||||
#if OPAQUE_VTBLS
|
||||
IrInterface::IrInterface(BaseClass* b, const llvm::ArrayType* vt)
|
||||
#else
|
||||
IrInterface::IrInterface(BaseClass* b, const llvm::StructType* vt)
|
||||
#endif
|
||||
{
|
||||
base = b;
|
||||
decl = b->base;
|
||||
|
||||
@@ -11,8 +11,13 @@ struct IrInterface : IrBase
|
||||
BaseClass* base;
|
||||
ClassDeclaration* decl;
|
||||
|
||||
#if OPAQUE_VTBLS
|
||||
const llvm::ArrayType* vtblTy;
|
||||
llvm::ConstantArray* vtblInit;
|
||||
#else
|
||||
const llvm::StructType* vtblTy;
|
||||
llvm::ConstantStruct* vtblInit;
|
||||
#endif
|
||||
llvm::GlobalVariable* vtbl;
|
||||
|
||||
const llvm::StructType* infoTy;
|
||||
@@ -21,7 +26,11 @@ struct IrInterface : IrBase
|
||||
|
||||
int index;
|
||||
|
||||
#if OPAQUE_VTBLS
|
||||
IrInterface(BaseClass* b, const llvm::ArrayType* vt);
|
||||
#else
|
||||
IrInterface(BaseClass* b, const llvm::StructType* vt);
|
||||
#endif
|
||||
~IrInterface();
|
||||
};
|
||||
|
||||
@@ -67,7 +76,11 @@ public:
|
||||
bool constinited;
|
||||
|
||||
llvm::GlobalVariable* vtbl;
|
||||
#if OPAQUE_VTBLS
|
||||
llvm::ConstantArray* constVtbl;
|
||||
#else
|
||||
llvm::ConstantStruct* constVtbl;
|
||||
#endif
|
||||
llvm::GlobalVariable* init;
|
||||
llvm::Constant* constInit;
|
||||
llvm::GlobalVariable* classInfo;
|
||||
|
||||
@@ -21,7 +21,9 @@ IrType::IrType(const IrType& s)
|
||||
{
|
||||
assert(list.insert(this).second);
|
||||
type = s.type;
|
||||
#if OPAQUE_VTBLS
|
||||
vtblType = s.type;
|
||||
#endif
|
||||
}
|
||||
|
||||
IrType::~IrType()
|
||||
@@ -32,5 +34,7 @@ IrType::~IrType()
|
||||
void IrType::reset()
|
||||
{
|
||||
type = NULL;
|
||||
#if OPAQUE_VTBLS
|
||||
vtblType = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ struct IrType
|
||||
void reset();
|
||||
|
||||
llvm::PATypeHolder* type;
|
||||
#if !OPAQUE_VTBLS
|
||||
llvm::PATypeHolder* vtblType;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user