comparison dmd/attrib.c @ 1103:b30fe7e1dbb9

- Updated to DMD frontend 1.041. - Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Thu, 12 Mar 2009 20:37:27 +0100
parents a8cb25d478c4
children 1860414bf3b7
comparison
equal deleted inserted replaced
1102:ae950bd712d3 1103:b30fe7e1dbb9
10 10
11 #include <stdio.h> 11 #include <stdio.h>
12 #include <stdlib.h> 12 #include <stdlib.h>
13 #include <assert.h> 13 #include <assert.h>
14 14
15 #if _WIN32 || IN_GCC || IN_LLVM 15 #include "rmem.h"
16 #include "mem.h"
17 #elif POSIX
18 #include "../root/mem.h"
19 #endif
20 16
21 #include "init.h" 17 #include "init.h"
22 #include "declaration.h" 18 #include "declaration.h"
23 #include "attrib.h" 19 #include "attrib.h"
24 #include "cond.h" 20 #include "cond.h"
149 145
150 void AttribDeclaration::emitComment(Scope *sc) 146 void AttribDeclaration::emitComment(Scope *sc)
151 { 147 {
152 //printf("AttribDeclaration::emitComment(sc = %p)\n", sc); 148 //printf("AttribDeclaration::emitComment(sc = %p)\n", sc);
153 149
150 /* A general problem with this, illustrated by BUGZILLA 2516,
151 * is that attributes are not transmitted through to the underlying
152 * member declarations for template bodies, because semantic analysis
153 * is not done for template declaration bodies
154 * (only template instantiations).
155 * Hence, Ddoc omits attributes from template members.
156 */
157
154 Array *d = include(NULL, NULL); 158 Array *d = include(NULL, NULL);
155 159
156 if (d) 160 if (d)
157 { 161 {
158 for (unsigned i = 0; i < d->dim; i++) 162 for (unsigned i = 0; i < d->dim; i++)
324 { STCauto, TOKauto }, 328 { STCauto, TOKauto },
325 { STCscope, TOKscope }, 329 { STCscope, TOKscope },
326 { STCstatic, TOKstatic }, 330 { STCstatic, TOKstatic },
327 { STCextern, TOKextern }, 331 { STCextern, TOKextern },
328 { STCconst, TOKconst }, 332 { STCconst, TOKconst },
333 // { STCinvariant, TOKimmutable },
334 // { STCshared, TOKshared },
329 { STCfinal, TOKfinal }, 335 { STCfinal, TOKfinal },
330 { STCabstract, TOKabstract }, 336 { STCabstract, TOKabstract },
331 { STCsynchronized, TOKsynchronized }, 337 { STCsynchronized, TOKsynchronized },
332 { STCdeprecated, TOKdeprecated }, 338 { STCdeprecated, TOKdeprecated },
333 { STCoverride, TOKoverride }, 339 { STCoverride, TOKoverride },
340 // { STCnothrow, TOKnothrow },
341 // { STCpure, TOKpure },
342 // { STCref, TOKref },
343 // { STCtls, TOKtls },
334 }; 344 };
335 345
336 int written = 0; 346 int written = 0;
337 for (int i = 0; i < sizeof(table)/sizeof(table[0]); i++) 347 for (int i = 0; i < sizeof(table)/sizeof(table[0]); i++)
338 { 348 {
610 // printf("\tad = %p\n", ad); 620 // printf("\tad = %p\n", ad);
611 // printf("\taad = %p\n", &aad); 621 // printf("\taad = %p\n", &aad);
612 622
613 sc = sc->push(); 623 sc = sc->push();
614 sc->anonAgg = &aad; 624 sc->anonAgg = &aad;
615 sc->stc &= ~(STCauto | STCscope | STCstatic); 625 sc->stc &= ~(STCauto | STCscope | STCstatic | STCtls);
616 sc->inunion = isunion; 626 sc->inunion = isunion;
617 sc->offset = 0; 627 sc->offset = 0;
618 sc->flags = 0; 628 sc->flags = 0;
619 aad.structalign = sc->structalign; 629 aad.structalign = sc->structalign;
620 aad.parent = ad; 630 aad.parent = ad;
751 this->args = args; 761 this->args = args;
752 } 762 }
753 763
754 Dsymbol *PragmaDeclaration::syntaxCopy(Dsymbol *s) 764 Dsymbol *PragmaDeclaration::syntaxCopy(Dsymbol *s)
755 { 765 {
766 //printf("PragmaDeclaration::syntaxCopy(%s)\n", toChars());
756 PragmaDeclaration *pd; 767 PragmaDeclaration *pd;
757 768
758 assert(!s); 769 assert(!s);
759 pd = new PragmaDeclaration(loc, ident, 770 pd = new PragmaDeclaration(loc, ident,
760 Expression::arraySyntaxCopy(args), Dsymbol::arraySyntaxCopy(decl)); 771 Expression::arraySyntaxCopy(args), Dsymbol::arraySyntaxCopy(decl));
1391 return sc; 1402 return sc;
1392 } 1403 }
1393 1404
1394 int CompileDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) 1405 int CompileDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum)
1395 { 1406 {
1396 //printf("CompileDeclaration::addMember(sc = %p)\n", sc); 1407 //printf("CompileDeclaration::addMember(sc = %p, memnum = %d)\n", sc, memnum);
1397 this->sd = sd; 1408 this->sd = sd;
1398 if (memnum == 0) 1409 if (memnum == 0)
1399 { /* No members yet, so parse the mixin now 1410 { /* No members yet, so parse the mixin now
1400 */ 1411 */
1401 compileIt(sc); 1412 compileIt(sc);