]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/d/dmd/doc.c
d: Merge upstream dmd 48d704f08
[thirdparty/gcc.git] / gcc / d / dmd / doc.c
index 22814c6d764600413fca37080601a2dcf7bdb2e1..a448e342a82b262b32e87583352f5f44c2528308 100644 (file)
@@ -124,7 +124,7 @@ int utfStride(const utf8_t *p);
 // Workaround for missing Parameter instance for variadic params. (it's unnecessary to instantiate one).
 bool isCVariadicParameter(Dsymbols *a, const utf8_t *p, size_t len)
 {
-    for (size_t i = 0; i < a->dim; i++)
+    for (size_t i = 0; i < a->length; i++)
     {
         TypeFunction *tf = isTypeFunction((*a)[i]);
         if (tf && tf->varargs == 1 && cmp("...", p, len) == 0)
@@ -140,7 +140,7 @@ static Parameter *isFunctionParameter(Dsymbol *s, const utf8_t *p, size_t len)
     TypeFunction *tf = isTypeFunction(s);
     if (tf && tf->parameters)
     {
-        for (size_t k = 0; k < tf->parameters->dim; k++)
+        for (size_t k = 0; k < tf->parameters->length; k++)
         {
             Parameter *fparam = (*tf->parameters)[k];
             if (fparam->ident && cmp(fparam->ident->toChars(), p, len) == 0)
@@ -173,7 +173,7 @@ static Dsymbol *getEponymousMember(TemplateDeclaration *td)
  */
 static Parameter *isEponymousFunctionParameter(Dsymbols *a, const utf8_t *p, size_t len)
 {
-    for (size_t i = 0; i < a->dim; i++)
+    for (size_t i = 0; i < a->length; i++)
     {
         TemplateDeclaration *td = (*a)[i]->isTemplateDeclaration();
         if (td && td->onemember)
@@ -354,7 +354,7 @@ void gendocfile(Module *m)
             global.params.ddocfiles->shift(p);
 
         // Override with the ddoc macro files from the command line
-        for (size_t i = 0; i < global.params.ddocfiles->dim; i++)
+        for (size_t i = 0; i < global.params.ddocfiles->length; i++)
         {
             FileName f((*global.params.ddocfiles)[i]);
             File file(&f);
@@ -668,7 +668,7 @@ static void expandTemplateMixinComments(TemplateMixin *tm, OutBuffer *buf, Scope
         tm->tempdecl->isTemplateDeclaration() : NULL;
     if (td && td->members)
     {
-        for (size_t i = 0; i < td->members->dim; i++)
+        for (size_t i = 0; i < td->members->length; i++)
         {
             Dsymbol *sm = (*td->members)[i];
             TemplateMixin *tmc = sm->isTemplateMixin();
@@ -705,7 +705,7 @@ void emitMemberComments(ScopeDsymbol *sds, OutBuffer *buf, Scope *sc)
 
     sc = sc->push(sds);
 
-    for (size_t i = 0; i < sds->members->dim; i++)
+    for (size_t i = 0; i < sds->members->length; i++)
     {
         Dsymbol *s = (*sds->members)[i];
         //printf("\ts = '%s'\n", s->toChars());
@@ -774,7 +774,7 @@ void emitComment(Dsymbol *s, OutBuffer *buf, Scope *sc)
             {
                 // Put the declaration signatures as the document 'title'
                 buf->writestring(ddoc_decl_s);
-                for (size_t i = 0; i < dc->a.dim; i++)
+                for (size_t i = 0; i < dc->a.length; i++)
                 {
                     Dsymbol *sx = dc->a[i];
 
@@ -888,7 +888,7 @@ void emitComment(Dsymbol *s, OutBuffer *buf, Scope *sc)
                 return;
             if (ed->isAnonymous() && ed->members)
             {
-                for (size_t i = 0; i < ed->members->dim; i++)
+                for (size_t i = 0; i < ed->members->length; i++)
                 {
                     Dsymbol *s = (*ed->members)[i];
                     emitComment(s, buf, sc);
@@ -930,7 +930,7 @@ void emitComment(Dsymbol *s, OutBuffer *buf, Scope *sc)
 
             if (d)
             {
-                for (size_t i = 0; i < d->dim; i++)
+                for (size_t i = 0; i < d->length; i++)
                 {
                     Dsymbol *s = (*d)[i];
                     //printf("AttribDeclaration::emitComment %s\n", s->toChars());
@@ -965,7 +965,7 @@ void emitComment(Dsymbol *s, OutBuffer *buf, Scope *sc)
              * a template, then include(NULL, NULL) will fail.
              */
             Dsymbols *d = cd->decl ? cd->decl : cd->elsedecl;
-            for (size_t i = 0; i < d->dim; i++)
+            for (size_t i = 0; i < d->length; i++)
             {
                 Dsymbol *s = (*d)[i];
                 emitComment(s, buf, sc);
@@ -1067,9 +1067,9 @@ void toDocBuffer(Dsymbol *s, OutBuffer *buf, Scope *sc)
             if (d->isVarDeclaration() && td)
             {
                 buf->writeByte('(');
-                if (td->origParameters && td->origParameters->dim)
+                if (td->origParameters && td->origParameters->length)
                 {
-                    for (size_t i = 0; i < td->origParameters->dim; i++)
+                    for (size_t i = 0; i < td->origParameters->length; i++)
                     {
                         if (i)
                             buf->writestring(", ");
@@ -1219,7 +1219,7 @@ void toDocBuffer(Dsymbol *s, OutBuffer *buf, Scope *sc)
                 buf->printf("%s %s", cd->kind(), cd->toChars());
             }
             int any = 0;
-            for (size_t i = 0; i < cd->baseclasses->dim; i++)
+            for (size_t i = 0; i < cd->baseclasses->length; i++)
             {
                 BaseClass *bc = (*cd->baseclasses)[i];
 
@@ -1288,7 +1288,7 @@ DocComment *DocComment::parse(Dsymbol *s, const utf8_t *comment)
 
     dc->parseSections(comment);
 
-    for (size_t i = 0; i < dc->sections.dim; i++)
+    for (size_t i = 0; i < dc->sections.length; i++)
     {
         Section *sec = dc->sections[i];
 
@@ -1444,7 +1444,7 @@ void DocComment::parseSections(const utf8_t *comment)
 
 void DocComment::writeSections(Scope *sc, Dsymbols *a, OutBuffer *buf)
 {
-    assert(a->dim);
+    assert(a->length);
 
     //printf("DocComment::writeSections()\n");
     Loc loc = (*a)[0]->loc;
@@ -1458,7 +1458,7 @@ void DocComment::writeSections(Scope *sc, Dsymbols *a, OutBuffer *buf)
     buf->writestring("$(DDOC_SECTIONS ");
     size_t offset2 = buf->offset;
 
-    for (size_t i = 0; i < sections.dim; i++)
+    for (size_t i = 0; i < sections.length; i++)
     {
         Section *sec = sections[i];
         if (sec->nooutput)
@@ -1478,7 +1478,7 @@ void DocComment::writeSections(Scope *sc, Dsymbols *a, OutBuffer *buf)
             sec->write(loc, this, sc, a, buf);
     }
 
-    for (size_t i = 0; i < a->dim; i++)
+    for (size_t i = 0; i < a->length; i++)
     {
         Dsymbol *s = (*a)[i];
         if (Dsymbol *td = getEponymousParent(s))
@@ -1528,7 +1528,7 @@ void DocComment::writeSections(Scope *sc, Dsymbols *a, OutBuffer *buf)
 
 void Section::write(Loc loc, DocComment *, Scope *sc, Dsymbols *a, OutBuffer *buf)
 {
-    assert(a->dim);
+    assert(a->length);
 
     if (namelen)
     {
@@ -1579,7 +1579,7 @@ void Section::write(Loc loc, DocComment *, Scope *sc, Dsymbols *a, OutBuffer *bu
 
 void ParamSection::write(Loc loc, DocComment *, Scope *sc, Dsymbols *a, OutBuffer *buf)
 {
-    assert(a->dim);
+    assert(a->length);
     Dsymbol *s = (*a)[0];   // test
 
     const utf8_t *p = body;
@@ -1730,10 +1730,10 @@ void ParamSection::write(Loc loc, DocComment *, Scope *sc, Dsymbols *a, OutBuffe
         goto L1;                // write out last one
     buf->writestring(")\n");
 
-    TypeFunction *tf = a->dim == 1 ? isTypeFunction(s) : NULL;
+    TypeFunction *tf = a->length == 1 ? isTypeFunction(s) : NULL;
     if (tf)
     {
-        size_t pcount = (tf->parameters ? tf->parameters->dim : 0) + (int)(tf->varargs == 1);
+        size_t pcount = (tf->parameters ? tf->parameters->length : 0) + (int)(tf->varargs == 1);
         if (pcount != paramcount)
         {
             warning(s->loc, "Ddoc: parameter count mismatch");
@@ -2109,7 +2109,7 @@ Lno:
 
 bool isIdentifier(Dsymbols *a, const utf8_t *p, size_t len)
 {
-    for (size_t i = 0; i < a->dim; i++)
+    for (size_t i = 0; i < a->length; i++)
     {
         const char *s = (*a)[i]->ident->toChars();
         if (cmp(s, p, len) == 0)
@@ -2156,7 +2156,7 @@ TypeFunction *isTypeFunction(Dsymbol *s)
 
 Parameter *isFunctionParameter(Dsymbols *a, const utf8_t *p, size_t len)
 {
-    for (size_t i = 0; i < a->dim; i++)
+    for (size_t i = 0; i < a->length; i++)
     {
         Parameter *fparam = isFunctionParameter((*a)[i], p, len);
         if (fparam)
@@ -2172,7 +2172,7 @@ Parameter *isFunctionParameter(Dsymbols *a, const utf8_t *p, size_t len)
 
 TemplateParameter *isTemplateParameter(Dsymbols *a, const utf8_t *p, size_t len)
 {
-    for (size_t i = 0; i < a->dim; i++)
+    for (size_t i = 0; i < a->length; i++)
     {
         TemplateDeclaration *td = (*a)[i]->isTemplateDeclaration();
         // Check for the parent, if the current symbol is not a template declaration.
@@ -2180,7 +2180,7 @@ TemplateParameter *isTemplateParameter(Dsymbols *a, const utf8_t *p, size_t len)
             td = getEponymousParent((*a)[i]);
         if (td && td->origParameters)
         {
-            for (size_t k = 0; k < td->origParameters->dim; k++)
+            for (size_t k = 0; k < td->origParameters->length; k++)
             {
                 TemplateParameter *tp = (*td->origParameters)[k];
                 if (tp->ident && cmp(tp->ident->toChars(), p, len) == 0)
@@ -2222,7 +2222,7 @@ bool isReservedName(utf8_t *str, size_t len)
 
 void highlightText(Scope *sc, Dsymbols *a, OutBuffer *buf, size_t offset)
 {
-    Dsymbol *s = a->dim ? (*a)[0] : NULL;   // test
+    Dsymbol *s = a->length ? (*a)[0] : NULL;   // test
 
     //printf("highlightText()\n");