From 521921e5d39e4b1f0573bdc624e23e412da1f66b Mon Sep 17 00:00:00 2001 From: kai Date: Sat, 25 Aug 2012 14:41:33 +0200 Subject: [PATCH] Fix some whitespace issues. --- dmd2/cast.c | 12 ++-- dmd2/constfold.c | 12 ++-- dmd2/declaration.c | 2 +- dmd2/declaration.h | 12 ++-- dmd2/expression.h | 10 +-- dmd2/func.c | 51 ++------------- dmd2/inline.c | 2 +- dmd2/intrange.h | 12 ++-- dmd2/module.h | 8 +-- dmd2/mtype.c | 150 ++++++++++++++++++++++----------------------- dmd2/statement.c | 50 +++++++-------- dmd2/statement.h | 2 +- dmd2/struct.c | 4 +- 13 files changed, 144 insertions(+), 183 deletions(-) diff --git a/dmd2/cast.c b/dmd2/cast.c index 7aaf2517..0db05863 100644 --- a/dmd2/cast.c +++ b/dmd2/cast.c @@ -636,7 +636,7 @@ MATCH AddrExp::implicitConvTo(Type *t) { Dsymbol *s = eo->vars->a[i]; FuncDeclaration *f2 = s->isFuncDeclaration(); assert(f2); - if (f2->overloadExactMatch(t->nextOf(), m)) + if (f2->overloadExactMatch(t->nextOf(), m)) { if (f) /* Error if match in more than one overload set, * even if one is a 'better' match than the other. @@ -662,7 +662,7 @@ MATCH AddrExp::implicitConvTo(Type *t) #endif VarExp *ve = (VarExp *)e1; FuncDeclaration *f = ve->var->isFuncDeclaration(); - if (f && f->overloadExactMatch(t->nextOf(), m)) + if (f && f->overloadExactMatch(t->nextOf(), m)) result = MATCHexact; } } @@ -692,7 +692,7 @@ MATCH SymOffExp::implicitConvTo(Type *t) { f = var->isFuncDeclaration(); if (f) - { f = f->overloadExactMatch(t->nextOf(), m); + { f = f->overloadExactMatch(t->nextOf(), m); if (f) { if ((t->ty == Tdelegate && (f->needThis() || f->isNested())) || (t->ty == Tpointer && !(f->needThis() || f->isNested()))) @@ -725,7 +725,7 @@ MATCH DelegateExp::implicitConvTo(Type *t) if (type->ty == Tdelegate && t->ty == Tdelegate) { - if (func && func->overloadExactMatch(t->nextOf(), m)) + if (func && func->overloadExactMatch(t->nextOf(), m)) result = MATCHexact; } } @@ -1476,7 +1476,7 @@ Expression *SymOffExp::castTo(Scope *sc, Type *t) f = var->isFuncDeclaration(); if (f) { - f = f->overloadExactMatch(tb->nextOf(), m); + f = f->overloadExactMatch(tb->nextOf(), m); if (f) { if (tb->ty == Tdelegate) @@ -1543,7 +1543,7 @@ Expression *DelegateExp::castTo(Scope *sc, Type *t) { if (func) { - f = func->overloadExactMatch(tb->nextOf(), m); + f = func->overloadExactMatch(tb->nextOf(), m); if (f) { int offset; if (f->tintro && f->tintro->nextOf()->isBaseOf(f->type->nextOf(), &offset) && offset) diff --git a/dmd2/constfold.c b/dmd2/constfold.c index 0be4cb82..887aa515 100644 --- a/dmd2/constfold.c +++ b/dmd2/constfold.c @@ -488,9 +488,9 @@ Expression *Mod(Type *type, Expression *e1, Expression *e2) #elif defined(IN_GCC) c = complex_t(e1->toReal() % r2, e1->toImaginary() % r2); #elif (defined(__FreeBSD__) && __FreeBSD_version < 800000) || defined(__arm__) || defined(__thumb__) - // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! - // arm also doesn't like fmodl - c = complex_t(fmod(e1->toReal(), r2), fmod(e1->toImaginary(), r2)); + // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! + // arm also doesn't like fmodl + c = complex_t(fmod(e1->toReal(), r2), fmod(e1->toImaginary(), r2)); #else c = complex_t(Port::fmodl(e1->toReal(), r2), Port::fmodl(e1->toImaginary(), r2)); #endif @@ -503,9 +503,9 @@ Expression *Mod(Type *type, Expression *e1, Expression *e2) #elif defined(IN_GCC) c = complex_t(e1->toReal() % i2, e1->toImaginary() % i2); #elif (defined(__FreeBSD__) && __FreeBSD_version < 800000) || defined(__arm__) || defined(__thumb__) - // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! - // arm also doesn't like fmodl - c = complex_t(fmod(e1->toReal(), i2), fmod(e1->toImaginary(), i2)); + // freebsd is kinda messed up. the STABLE branch doesn't support C99's fmodl !?! + // arm also doesn't like fmodl + c = complex_t(fmod(e1->toReal(), i2), fmod(e1->toImaginary(), i2)); #else c = complex_t(Port::fmodl(e1->toReal(), i2), Port::fmodl(e1->toImaginary(), i2)); #endif diff --git a/dmd2/declaration.c b/dmd2/declaration.c index 4da51432..8b5f5eab 100644 --- a/dmd2/declaration.c +++ b/dmd2/declaration.c @@ -1040,7 +1040,7 @@ Lnomatch: v->storage_class |= arg->storageClass; //printf("declaring field %s of type %s\n", v->toChars(), v->type->toChars()); v->semantic(sc); - + #if !IN_LLVM // removed for LDC since TupleDeclaration::toObj already creates the fields; // adding them to the scope again leads to duplicates diff --git a/dmd2/declaration.h b/dmd2/declaration.h index 5a546f63..66d87567 100644 --- a/dmd2/declaration.h +++ b/dmd2/declaration.h @@ -112,7 +112,7 @@ struct Match }; void overloadResolveX(Match *m, FuncDeclaration *f, - Expression *ethis, Expressions *arguments, Module* from); + Expression *ethis, Expressions *arguments, Module* from); int overloadApply(FuncDeclaration *fstart, int (*fp)(void *, FuncDeclaration *), void *param); @@ -256,7 +256,7 @@ struct AliasDeclaration : Declaration Dsymbol *aliassym; Dsymbol *overnext; // next in overload list int inSemantic; - PROT importprot; // if generated by import, store its protection + PROT importprot; // if generated by import, store its protection AliasDeclaration(Loc loc, Identifier *ident, Type *type); AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); @@ -879,7 +879,7 @@ struct FuncDeclaration : Declaration FuncDeclaration *isFuncDeclaration() { return this; } virtual FuncDeclaration *toAliasFunc() { return this; } - + #if IN_LLVM // LDC stuff @@ -906,7 +906,7 @@ struct FuncDeclaration : Declaration // true if overridden with the pragma(allow_inline); stmt bool allowInlining; - + // true if has inline assembler bool inlineAsm; #endif @@ -924,8 +924,8 @@ struct FuncAliasDeclaration : FuncDeclaration { FuncDeclaration *funcalias; int hasOverloads; - PROT importprot; // if generated by import, store its protection - + PROT importprot; // if generated by import, store its protection + FuncAliasDeclaration(FuncDeclaration *funcalias, int hasOverloads = 1); FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } diff --git a/dmd2/expression.h b/dmd2/expression.h index 762ff71c..8dea5625 100644 --- a/dmd2/expression.h +++ b/dmd2/expression.h @@ -719,7 +719,7 @@ struct SymbolExp : Expression struct SymOffExp : SymbolExp { unsigned offset; - Module* m; // starting point for overload resolution + Module* m; // starting point for overload resolution SymOffExp(Loc loc, Declaration *var, unsigned offset, int hasOverloads = 0); Expression *semantic(Scope *sc); @@ -1077,7 +1077,7 @@ struct DotTemplateInstanceExp : UnaExp struct DelegateExp : UnaExp { FuncDeclaration *func; - Module* m; // starting point for overload resolution + Module* m; // starting point for overload resolution int hasOverloads; DelegateExp(Loc loc, Expression *e, FuncDeclaration *func, int hasOverloads = 0); @@ -1152,7 +1152,7 @@ struct CallExp : UnaExp struct AddrExp : UnaExp { - Module* m; // starting point for overload resolution + Module* m; // starting point for overload resolution AddrExp(Loc loc, Expression *e); Expression *semantic(Scope *sc); @@ -1392,7 +1392,7 @@ struct ArrayLengthExp : UnaExp #endif static Expression *rewriteOpAssign(BinExp *exp); - + #if IN_LLVM DValue* toElem(IRState* irs); #endif @@ -1553,7 +1553,7 @@ struct op##AssignExp : BinAssignExp \ \ Identifier *opId(); /* For operator overloading */ \ \ - ASSIGNEXP_TOELEM \ + ASSIGNEXP_TOELEM \ }; #define X(a) a diff --git a/dmd2/func.c b/dmd2/func.c index eb512522..852c16bb 100644 --- a/dmd2/func.c +++ b/dmd2/func.c @@ -492,7 +492,7 @@ void FuncDeclaration::semantic(Scope *sc) if (s) { FuncDeclaration *f = s->isFuncDeclaration(); - f = f->overloadExactMatch(type, getModule()); + f = f->overloadExactMatch(type, getModule()); if (f && f->isFinal() && f->prot() != PROTprivate) error("cannot override final function %s", f->toPrettyChars()); } @@ -1071,7 +1071,7 @@ void FuncDeclaration::semantic3(Scope *sc) if (f->parameters) { for (size_t i = 0; i < Parameter::dim(f->parameters); i++) - { Parameter *arg = (Parameter *)Parameter::getNth(f->parameters, i); + { Parameter *arg = (Parameter *)Parameter::getNth(f->parameters, i); Type* nw = arg->type->semantic(0, sc); if (arg->type != nw) { arg->type = nw; @@ -1633,8 +1633,8 @@ void FuncDeclaration::semantic3(Scope *sc) } else { // Call invariant virtually - ThisExp* tv = new ThisExp(0); - tv->type = vthis->type; + ThisExp* tv = new ThisExp(0); + tv->type = vthis->type; tv->var = vthis; Expression *v = tv; @@ -1648,7 +1648,7 @@ void FuncDeclaration::semantic3(Scope *sc) se->type = Type::tchar->arrayOf(); #endif e = new AssertExp(loc, v, se); - } + } if (ee) { ExpStatement *s = new ExpStatement(0, ee); @@ -1695,45 +1695,6 @@ void FuncDeclaration::semantic3(Scope *sc) } fbody = new CompoundStatement(0, a); - -#if 0 // This seems to have been added in with dmd 2.032, see below - // wrap body of synchronized functions in a synchronized statement - if (isSynchronized()) - { - ClassDeclaration *cd = parent->isClassDeclaration(); - if (!cd) - error("synchronized function %s must be a member of a class", toChars()); - - Expression *sync; - if (isStatic()) - { - // static member functions synchronize on classinfo - sync = cd->type->dotExp(sc2, new TypeExp(loc, cd->type), Id::classinfo); - } - else - { - // non-static member functions synchronize on this - sync = new VarExp(loc, vthis); - } - - // we do not want to rerun semantics on the whole function, so we - // manually adjust all labels in the function that currently don't - // have an enclosingScopeExit to use the new SynchronizedStatement - SynchronizedStatement* s = new SynchronizedStatement(loc, sync, NULL); - s->semantic(sc2); - s->body = fbody; - - // LDC - LabelMap::iterator it, end = labmap.end(); - for (it = labmap.begin(); it != end; ++it) - if (it->second->enclosingScopeExit == NULL) - it->second->enclosingScopeExit = s; - - a = new Statements; - a->push(s); - fbody = new CompoundStatement(0, a); - } -#endif #if DMDV2 /* Append destructor calls for parameters as finally blocks. */ @@ -2503,7 +2464,7 @@ int fp2(void *param, FuncDeclaration *f) void overloadResolveX(Match *m, FuncDeclaration *fstart, - Expression *ethis, Expressions *arguments, Module* from) + Expression *ethis, Expressions *arguments, Module* from) { Param2 p; p.m = m; diff --git a/dmd2/inline.c b/dmd2/inline.c index 47eebe6d..6b3f589f 100644 --- a/dmd2/inline.c +++ b/dmd2/inline.c @@ -262,7 +262,7 @@ int StructLiteralExp::inlineCost3(InlineCostState *ics) int FuncExp::inlineCost3(InlineCostState *ics) { //printf("FuncExp::inlineCost3()\n"); - + // This breaks on LDC too, since nested functions have internal linkage // and thus can't be referenced from other objects. // Right now, this makes the function be output to the .obj file twice. diff --git a/dmd2/intrange.h b/dmd2/intrange.h index 77685b02..2904dab9 100644 --- a/dmd2/intrange.h +++ b/dmd2/intrange.h @@ -95,14 +95,14 @@ struct IntRange IntRange(const SignExtendedNumber& a) : imin(a), imax(a) {} /// Create a range with the lower and upper bounds. - IntRange(const SignExtendedNumber& lower, const SignExtendedNumber& upper) + IntRange(const SignExtendedNumber& lower, const SignExtendedNumber& upper) : imin(lower), imax(upper) {} - + /// Create the tightest range containing all valid integers in the specified - /// type. + /// type. static IntRange fromType(Type *type); /// Create the tightest range containing all valid integers in the type with - /// a forced signedness. + /// a forced signedness. static IntRange fromType(Type *type, bool isUnsigned); @@ -131,7 +131,7 @@ struct IntRange /// Check if this range contains 0. bool containsZero() const; - /// Compute the range of the negated absolute values of the original range. + /// Compute the range of the negated absolute values of the original range. IntRange absNeg() const; /// Compute the union of two ranges. @@ -139,7 +139,7 @@ struct IntRange void unionOrAssign(const IntRange& other, bool& union_); /// Dump the content of the integer range to the console. - const IntRange& dump(const char* funcName, Expression *e) const; + const IntRange& dump(const char* funcName, Expression *e) const; /// Split the range into two nonnegative- and negative-only subintervals. void splitBySign(IntRange& negRange, bool& hasNegRange, diff --git a/dmd2/module.h b/dmd2/module.h index 609017ea..dc241543 100644 --- a/dmd2/module.h +++ b/dmd2/module.h @@ -76,7 +76,7 @@ struct Module : Package File *hdrfile; // 'header' file File *symfile; // output symbol file File *docfile; // output documentation file - + unsigned errors; // if any errors in file unsigned numlines; // number of lines in source file int isHtml; // if it is an HTML file @@ -123,9 +123,9 @@ struct Module : Package size_t nameoffset; // offset of module name from start of ModuleInfo size_t namelen; // length of module name in characters - - int doDocComment; // enable generating doc comments for this module - int doHdrGen; // enable generating header file for this module + + int doDocComment; // enable generating doc comments for this module + int doHdrGen; // enable generating header file for this module Module(char *arg, Identifier *ident, int doDocComment, int doHdrGen); ~Module(); diff --git a/dmd2/mtype.c b/dmd2/mtype.c index 2958f4e9..72cab1f9 100644 --- a/dmd2/mtype.c +++ b/dmd2/mtype.c @@ -2260,7 +2260,7 @@ Identifier *Type::getTypeInfoIdent(int internal) // LDC // it is not clear where the underscore that's stripped here is added back in // if (global.params.isWindows) -// name++; // C mangling will add it back in +// name++; // C mangling will add it back in //printf("name = %s\n", name); id = Lexer::idPool(name); return id; @@ -4060,7 +4060,7 @@ void TypeSArray::toDecoBuffer(OutBuffer *buf, int flag, bool mangle) * level, since for T[4][3], any const should apply to the T, * not the [4]. */ - next->toDecoBuffer(buf, (flag & 0x100) ? flag : mod, mangle); + next->toDecoBuffer(buf, (flag & 0x100) ? flag : mod, mangle); } void TypeSArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) @@ -4334,7 +4334,7 @@ void TypeDArray::toDecoBuffer(OutBuffer *buf, int flag, bool mangle) { Type::toDecoBuffer(buf, flag, mangle); if (next) - next->toDecoBuffer(buf, (flag & 0x100) ? 0 : mod, mangle); + next->toDecoBuffer(buf, (flag & 0x100) ? 0 : mod, mangle); } void TypeDArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) @@ -4677,19 +4677,19 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident) Expression *ec; Expressions *arguments; - //LDC: Build arguments. - static FuncDeclaration *aaLen_fd = NULL; - if(!aaLen_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - aaLen_fd = FuncDeclaration::genCfunc(args, Type::tsize_t, Id::aaLen); - } + //LDC: Build arguments. + static FuncDeclaration *aaLen_fd = NULL; + if(!aaLen_fd) { + Arguments* args = new Arguments; + args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + aaLen_fd = FuncDeclaration::genCfunc(args, Type::tsize_t, Id::aaLen); + } - ec = new VarExp(0, aaLen_fd); + ec = new VarExp(0, aaLen_fd); arguments = new Expressions(); arguments->push(e); e = new CallExp(e->loc, ec, arguments); - e->type = aaLen_fd->type->nextOf(); + e->type = aaLen_fd->type->nextOf(); } else if (ident == Id::keys) @@ -4699,16 +4699,16 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident) int size = index->size(e->loc); assert(size); - //LDC: Build arguments. - static FuncDeclaration *aaKeys_fd = NULL; - if(!aaKeys_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); - aaKeys_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaKeys); - } + //LDC: Build arguments. + static FuncDeclaration *aaKeys_fd = NULL; + if(!aaKeys_fd) { + Arguments* args = new Arguments; + args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); + aaKeys_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaKeys); + } - ec = new VarExp(0, aaKeys_fd); + ec = new VarExp(0, aaKeys_fd); arguments = new Expressions(); arguments->push(e); arguments->push(new IntegerExp(0, size, Type::tsize_t)); @@ -4720,17 +4720,17 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident) Expression *ec; Expressions *arguments; - //LDC: Build arguments. - static FuncDeclaration *aaValues_fd = NULL; - if(!aaValues_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); - args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); - aaValues_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaValues); - } + //LDC: Build arguments. + static FuncDeclaration *aaValues_fd = NULL; + if(!aaValues_fd) { + Arguments* args = new Arguments; + args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); + args->push(new Argument(STCin, Type::tsize_t, NULL, NULL)); + aaValues_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaValues); + } - ec = new VarExp(0, aaValues_fd); + ec = new VarExp(0, aaValues_fd); arguments = new Expressions(); arguments->push(e); size_t keysize = index->size(e->loc); @@ -4745,19 +4745,19 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident) Expression *ec; Expressions *arguments; - //LDC: Build arguments. - static FuncDeclaration *aaRehash_fd = NULL; - if(!aaRehash_fd) { - Arguments* args = new Arguments; - args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); - args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); - aaRehash_fd = FuncDeclaration::genCfunc(args, Type::tvoidptr, Id::aaRehash); - } + //LDC: Build arguments. + static FuncDeclaration *aaRehash_fd = NULL; + if(!aaRehash_fd) { + Arguments* args = new Arguments; + args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL)); + args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL)); + aaRehash_fd = FuncDeclaration::genCfunc(args, Type::tvoidptr, Id::aaRehash); + } - ec = new VarExp(0, aaRehash_fd); + ec = new VarExp(0, aaRehash_fd); arguments = new Expressions(); arguments->push(e->addressOf(sc)); - arguments->push(index->getInternalTypeInfo(sc)); // LDC doesn't support getInternalTypeInfo, see above + arguments->push(index->getInternalTypeInfo(sc)); // LDC doesn't support getInternalTypeInfo, see above e = new CallExp(e->loc, ec, arguments); e->type = this; } @@ -8464,44 +8464,44 @@ L1: e->type = t; // do this so we don't get redundant dereference } else - { - /* For class objects, the classinfo reference is the first - * entry in the vtbl[] - */ + { + /* For class objects, the classinfo reference is the first + * entry in the vtbl[] + */ #if IN_LLVM - Type* ct; - if (sym->isInterfaceDeclaration()) { - ct = t->pointerTo()->pointerTo()->pointerTo(); - } - else { - ct = t->pointerTo()->pointerTo(); - } + Type* ct; + if (sym->isInterfaceDeclaration()) { + ct = t->pointerTo()->pointerTo()->pointerTo(); + } + else { + ct = t->pointerTo()->pointerTo(); + } - e = e->castTo(sc, ct); - e = new PtrExp(e->loc, e); - e->type = ct->nextOf(); - e = new PtrExp(e->loc, e); - e->type = ct->nextOf()->nextOf(); + e = e->castTo(sc, ct); + e = new PtrExp(e->loc, e); + e->type = ct->nextOf(); + e = new PtrExp(e->loc, e); + e->type = ct->nextOf()->nextOf(); - if (sym->isInterfaceDeclaration()) - { - if (sym->isCOMinterface()) - { /* COM interface vtbl[]s are different in that the - * first entry is always pointer to QueryInterface(). - * We can't get a .classinfo for it. - */ - error(e->loc, "no .classinfo for COM interface objects"); + if (sym->isInterfaceDeclaration()) + { + if (sym->isCOMinterface()) + { /* COM interface vtbl[]s are different in that the + * first entry is always pointer to QueryInterface(). + * We can't get a .classinfo for it. + */ + error(e->loc, "no .classinfo for COM interface objects"); + } + /* For an interface, the first entry in the vtbl[] + * is actually a pointer to an instance of struct Interface. + * The first member of Interface is the .classinfo, + * so add an extra pointer indirection. + */ + e = new PtrExp(e->loc, e); + e->type = ct->nextOf()->nextOf()->nextOf(); + } } - /* For an interface, the first entry in the vtbl[] - * is actually a pointer to an instance of struct Interface. - * The first member of Interface is the .classinfo, - * so add an extra pointer indirection. - */ - e = new PtrExp(e->loc, e); - e->type = ct->nextOf()->nextOf()->nextOf(); - } - } #else @@ -8527,7 +8527,7 @@ L1: e->type = t->pointerTo(); } e = new PtrExp(e->loc, e, t); - } + } #endif // !LDC diff --git a/dmd2/statement.c b/dmd2/statement.c index 66a32704..28f44e8a 100644 --- a/dmd2/statement.c +++ b/dmd2/statement.c @@ -2244,23 +2244,23 @@ Lagain: const char *r = (op == TOKforeach_reverse) ? "R" : ""; int j = sprintf(fdname, "_aApply%s%.*s%llu", r, 2, fntab[flag], (ulonglong)dim); assert(j < sizeof(fdname)); - //LDC: Build arguments. - Parameters* args = new Parameters; - args->push(new Parameter(STCin, tn->arrayOf(), NULL, NULL)); - if (dim == 2) { + //LDC: Build arguments. + Parameters* args = new Parameters; + args->push(new Parameter(STCin, tn->arrayOf(), NULL, NULL)); + if (dim == 2) { Parameters* dgargs = new Parameters; dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd)); args->push(new Parameter(STCin, dgty, NULL, NULL)); fdapply = FuncDeclaration::genCfunc(args, Type::tint32, fdname); - } else { + } else { Parameters* dgargs = new Parameters; dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd)); args->push(new Parameter(STCin, dgty, NULL, NULL)); fdapply = FuncDeclaration::genCfunc(args, Type::tint32, fdname); - } + } ec = new VarExp(0, fdapply); Expressions *exps = new Expressions(); @@ -3371,11 +3371,11 @@ Statement *CaseStatement::semantic(Scope *sc) if (sw) { #if IN_LLVM - enclosingScopeExit = sc->enclosingScopeExit; - if (enclosingScopeExit != sw->enclosingScopeExit) - { - error("case must be inside the same try, synchronized or volatile level as switch"); - } + enclosingScopeExit = sc->enclosingScopeExit; + if (enclosingScopeExit != sw->enclosingScopeExit) + { + error("case must be inside the same try, synchronized or volatile level as switch"); + } #endif exp = exp->implicitCastTo(sc, sw->condition->type); exp = exp->optimize(WANTvalue); @@ -3695,7 +3695,7 @@ Statement *GotoCaseStatement::semantic(Scope *sc) error("goto case not in switch statement"); else { - sw = sc->sw; + sw = sc->sw; sc->sw->gotoCases.push(this); if (exp) { @@ -4170,10 +4170,10 @@ Statement *BreakStatement::semantic(Scope *sc) if (!s->hasBreak()) error("label '%s' has no break", ident->toChars()); - if (ls->enclosingFinally != sc->enclosingFinally) + if (ls->enclosingFinally != sc->enclosingFinally) error("cannot break out of finally block"); - - this->target = ls; + + this->target = ls; return this; } } @@ -4273,10 +4273,10 @@ Statement *ContinueStatement::semantic(Scope *sc) if (!s->hasContinue()) error("label '%s' has no continue", ident->toChars()); - if (ls->enclosingFinally != sc->enclosingFinally) + if (ls->enclosingFinally != sc->enclosingFinally) error("cannot continue out of finally block"); - - this->target = ls; + + this->target = ls; return this; } } @@ -4412,7 +4412,7 @@ Statement *SynchronizedStatement::semantic(Scope *sc) * try { body } finally { _d_criticalexit(critsec.ptr); } */ Identifier *id = Lexer::uniqueId("__critsec"); - Type *t = new TypeSArray(Type::tint8, new IntegerExp(PTRSIZE + os_critsecsize())); + Type *t = new TypeSArray(Type::tint8, new IntegerExp(PTRSIZE + os_critsecsize())); VarDeclaration *tmp = new VarDeclaration(loc, t, id, NULL); tmp->storage_class |= STCgshared | STCstatic; @@ -4454,10 +4454,10 @@ Statement *SynchronizedStatement::semantic(Scope *sc) Lbody: if (body) { - Statement* oldScopeExit = sc->enclosingScopeExit; - sc->enclosingScopeExit = this; + Statement* oldScopeExit = sc->enclosingScopeExit; + sc->enclosingScopeExit = this; body = body->semantic(sc); - sc->enclosingScopeExit = oldScopeExit; + sc->enclosingScopeExit = oldScopeExit; } return this; } @@ -5051,10 +5051,10 @@ Statement *VolatileStatement::semantic(Scope *sc) { if (statement) { - Statement* oldScopeExit = sc->enclosingScopeExit; - sc->enclosingScopeExit = this; + Statement* oldScopeExit = sc->enclosingScopeExit; + sc->enclosingScopeExit = this; statement = statement->semantic(sc); - sc->enclosingScopeExit = oldScopeExit; + sc->enclosingScopeExit = oldScopeExit; } return this; } diff --git a/dmd2/statement.h b/dmd2/statement.h index 2bd213dc..95336e13 100644 --- a/dmd2/statement.h +++ b/dmd2/statement.h @@ -961,7 +961,7 @@ struct AsmStatement : Statement //Statement *inlineScan(InlineScanState *iss); void toIR(IRState *irs); - + #if IN_LLVM // non-zero if this is a branch, contains the target labels identifier Identifier* isBranchToLabel; diff --git a/dmd2/struct.c b/dmd2/struct.c index 51e6c3a7..d38cc3fc 100644 --- a/dmd2/struct.c +++ b/dmd2/struct.c @@ -584,9 +584,9 @@ void StructDeclaration::semantic(Scope *sc) Dsymbol *s = search_function(this, id); FuncDeclaration *fdx = s ? s->isFuncDeclaration() : NULL; if (fdx) - { FuncDeclaration *fd = fdx->overloadExactMatch(tfeqptr, getModule()); + { FuncDeclaration *fd = fdx->overloadExactMatch(tfeqptr, getModule()); if (!fd) - { fd = fdx->overloadExactMatch(tfeq, getModule()); + { fd = fdx->overloadExactMatch(tfeq, getModule()); if (fd) { // Create the thunk, fdptr FuncDeclaration *fdptr = new FuncDeclaration(loc, loc, fdx->ident, STCundefined, tfeqptr);