From a38d34dead73ebd4cdefccfdf620987210114585 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 23 Apr 2009 20:28:29 +0200 Subject: [PATCH 1/4] Trivial fix for bug #265 --- dmd/expression.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dmd/expression.c b/dmd/expression.c index 1f182ea3..f56d1f86 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -5800,7 +5800,10 @@ Expression *DotTemplateInstanceExp::semantic(Scope *sc) id = ti->name; s2 = s->search(loc, id, 0); if (!s2) - { error("template identifier %s is not a member of %s %s", id->toChars(), s->kind(), s->ident->toChars()); + { if (s->ident) + error("template identifier %s is not a member of %s %s", id->toChars(), s->kind(), s->ident->toChars()); + else + error("template identifier %s is not a member of %s", id->toChars(), s->kind()); goto Lerr; } s = s2; From 0485196ae81dbfd9afb5a6506bc537edb1127e54 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 23 Apr 2009 20:44:55 +0200 Subject: [PATCH 2/4] Fix parsing of import statements to only pass valid identifiers to Import constructor. Fixes #264. --- dmd/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmd/parse.c b/dmd/parse.c index c19c13c6..098caf23 100644 --- a/dmd/parse.c +++ b/dmd/parse.c @@ -1640,7 +1640,7 @@ Import *Parser::parseImport(Array *decldefs, int isstatic) nextToken(); } - s = new Import(loc, a, token.ident, aliasid, isstatic); + s = new Import(loc, a, id, aliasid, isstatic); decldefs->push(s); /* Look for From 83dda319ae670b5299238fa14eec3328d54cd4b1 Mon Sep 17 00:00:00 2001 From: Frits van Bommel Date: Fri, 24 Apr 2009 16:47:42 +0200 Subject: [PATCH 3/4] Add `#include "gen/llvm-version.h"` to files that use the macro it defines... --- gen/abi-x86-64.cpp | 3 +++ gen/main.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/gen/abi-x86-64.cpp b/gen/abi-x86-64.cpp index aff42be7..7fdbb5d0 100644 --- a/gen/abi-x86-64.cpp +++ b/gen/abi-x86-64.cpp @@ -43,6 +43,7 @@ #include "gen/llvmhelpers.h" #include "gen/abi.h" #include "gen/abi-x86-64.h" +//#include "gen/llvm-version.h" // only use is commented out. #include "ir/irfunction.h" #include @@ -401,6 +402,8 @@ namespace x86_64_D_cc { // 'fastcc' allows returns in up to two registers of each kind: DRegCount state(2, 2, 2); #if 1 //LLVM_REV < 67588 + // (If uncommenting the LLVM_REV line above, also uncomment llvm-version #include + // LLVM before trunk r67588 doesn't allow a second int to be an i1 or // i8. (See ) // Rather than complicating shouldPassStructInRegs(), just disallow diff --git a/gen/main.cpp b/gen/main.cpp index df6d68f7..6a870a06 100644 --- a/gen/main.cpp +++ b/gen/main.cpp @@ -36,6 +36,7 @@ #include "gen/linker.h" #include "gen/irstate.h" #include "gen/toobj.h" +#include "gen/llvm-version.h" #include "gen/cl_options.h" #include "gen/cl_helpers.h" From 8916f783b74d14c04d7dd80a9b39e7cfc262014b Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 25 Apr 2009 09:11:32 +0200 Subject: [PATCH 4/4] Revert change to treat bodyless functions in abstract classes as abstract. See DMD bug 2894. --- gen/functions.cpp | 7 ++----- ir/irclass.cpp | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/gen/functions.cpp b/gen/functions.cpp index f8867d53..c52b3f12 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -386,11 +386,8 @@ void DtoResolveFunction(FuncDeclaration* fdecl) Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars()); LOG_SCOPE; - // queue declaration unless the function is abstract without body; - // bodyless functions in an abstract class are considered abstract - ClassDeclaration* cd = fdecl->isMember() ? fdecl->isMember()->isClassDeclaration() : NULL; - bool isabstract = fdecl->isAbstract() || (cd && cd->isAbstract()); - if (!isabstract || fdecl->fbody) + // queue declaration unless the function is abstract without body + if (!fdecl->isAbstract() || fdecl->fbody) { DtoDeclareFunction(fdecl); } diff --git a/ir/irclass.cpp b/ir/irclass.cpp index de8717ab..9a7a96ef 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -132,7 +132,7 @@ LLConstant * IrStruct::getVtblInit() FuncDeclaration* fd = dsym->isFuncDeclaration(); assert(fd && "vtbl entry not a function"); - if ((cd->isAbstract() || fd->isAbstract()) && !fd->fbody) + if (fd->isAbstract() && !fd->fbody) { c = getNullValue(DtoType(fd->type->pointerTo())); } @@ -335,7 +335,7 @@ llvm::GlobalVariable * IrStruct::getInterfaceVtbl(BaseClass * b, bool new_instan FuncDeclaration* fd = dsym->isFuncDeclaration(); assert(fd && "vtbl entry not a function"); - assert(!((fd->isAbstract() || cd->isAbstract()) && !fd->fbody) && + assert((!fd->isAbstract() || fd->fbody) && "null symbol in interface implementation vtable"); fd->codegen(Type::sir);