Skip to content

Commit a3e5c84

Browse files
committed
fix some bugs
1 parent b7b6627 commit a3e5c84

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

ldc/ir/irclass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ IrClass::IrClass(ClassDeclaration *cd) : IrAggr(cd) {
5151
}
5252

5353
void IrClass::addInterfaceVtbls(ClassDeclaration *cd) {
54+
55+
// No interface vtables in Objective-C
56+
if (cd->classKind == ClassKind::objc)
57+
return;
58+
5459
if (cd->baseClass && !cd->isInterfaceDeclaration()) {
5560
addInterfaceVtbls(cd->baseClass);
5661
}

ldc/ir/irtypeaggr.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ void AggrTypeBuilder::addAggregate(
6060

6161
// extern(Objective-C) classes have members laid out at runtime, so we
6262
// don't want to try to do anything here for those; their stuff is set up elsewhere
63-
if (ad->classKind == ClassKind::objc)
63+
if (ad->classKind == ClassKind::objc) {
64+
this->addType(getVoidPtrType(), gDataLayout->getPointerSize());
6465
return;
66+
}
6567

6668
// Unions may lead to overlapping fields, and we need to flatten them for LLVM
6769
// IR. We usually take the first field (in declaration order) of an

ldc/ir/irtypeclass.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ IrTypeClass *IrTypeClass::get(ClassDeclaration *cd) {
7272

7373
AggrTypeBuilder builder;
7474

75+
// Objective-C just has an ISA pointer, so just
76+
// throw that in there.
77+
if (cd->classKind == ClassKind::objc) {
78+
builder.addType(getVoidPtrType(), target.ptrsize);
79+
isaStruct(t->type)->setBody(builder.defaultTypes(), builder.isPacked());
80+
return t;
81+
}
82+
7583
// add vtbl
7684
builder.addType(llvm::PointerType::get(t->vtbl_type, 0), target.ptrsize);
7785

opend/src/opend.d

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ int main(string[] args) {
2929
} else switch(allOtherArgs[1]) {
3030
foreach(memberName; __traits(allMembers, Commands))
3131
case memberName:
32-
return __traits(getMember, Commands, memberName)(buildSpecificArgs ~ allOtherArgs[2 .. $]);
32+
string[] argsToSend = allOtherArgs[2 .. $];
33+
if(memberName == "build" || memberName == "test" || memberName == "publish" || memberName == "testOnly" || memberName == "check")
34+
argsToSend = buildSpecificArgs ~ allOtherArgs[2 .. $];
35+
return __traits(getMember, Commands, memberName)(argsToSend);
3336
case "-h", "--help":
3437
import std.stdio, std.string;
3538
foreach(memberName; __traits(allMembers, Commands))
@@ -271,6 +274,7 @@ struct Commands {
271274
// publish-source which puts the dependencies together?
272275
// locate-module which spits out the path to a particular module
273276
// fetch-dependencies
277+
// needs to keep the whole directory of source but figure out where it is an d put it in the correct place.
274278

275279
// if i do a server thing i need to be able to migrate it between attached displays
276280

0 commit comments

Comments
 (0)