}
gcc_assert (!inbacktick);
- return buf.extractString ();
+ return buf.extractChars ();
}
/* Helper routine for all error routines. Reports a diagnostic specified by
buf.printf (":%u", this->charnum);
}
- return buf.extractString ();
+ return buf.extractChars ();
}
bool
/* Write out make target module name. */
if (d_option.deps_target)
{
- buffer->writestring (d_option.deps_target->extractString ());
+ buffer->writestring (d_option.deps_target->extractChars ());
column = d_option.deps_target->offset;
}
else
to make the middle-end fully deterministic. */
OutBuffer buf;
mangleToBuffer (Module::rootModule, &buf);
- first_global_object_name = buf.extractString ();
+ first_global_object_name = buf.extractChars ();
}
/* Make dependencies. */
{
OutBuffer buf;
mangleToBuffer (decl, &buf);
- return buf.extractString ();
+ return buf.extractChars ();
}
}
-b0df0e982cc44bd09a9061acfc8160f29767334a
+108ca1bcde2096a2c6173c567a204d749538dd74
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
*/
buf.writestring(e->type->toBasetype()->nextOf()->toBasetype()->mutableOf()->deco);
- char *name = buf.peekString();
+ char *name = buf.peekChars();
Identifier *ident = Identifier::idPool(name);
FuncDeclaration **pFd = (FuncDeclaration **)dmd_aaGet(&arrayfuncs, (void *)ident);
buf.writeByte('\'');
protectionToBuffer(&buf, protection);
buf.writeByte('\'');
- return buf.extractString();
+ return buf.extractChars();
}
/********************************* AlignDeclaration ****************************/
if (args->length)
buf.writeByte(')');
}
- message("pragma %s", buf.peekString());
+ message("pragma %s", buf.peekChars());
}
goto Lnodecl;
}
* ::= <prefix> <data-member-prefix>
*/
prefix_name(p);
- //printf("p: %s\n", buf.peekString());
+ //printf("p: %s\n", buf.peekChars());
if (d->isCtorDeclaration())
{
{
buf->writestring("_ZTI");
cpp_mangle_name(s, false);
- return buf->extractString();
+ return buf->extractChars();
}
};
OutBuffer buf;
CppMangleVisitor v(&buf, s->loc);
v.mangleOf(s);
- return buf.extractString();
+ return buf.extractChars();
}
const char *cppTypeInfoMangleItanium(Dsymbol *s)
buf.writestring("_ZTI"); // "TI" means typeinfo structure
CppMangleVisitor v(&buf, s->loc);
v.cpp_mangle_name(s, false);
- return buf.extractString();
+ return buf.extractChars();
}
OutBuffer buf;
buf.printf("__%s_field_%llu", ident->toChars(), (ulonglong)i);
- const char *name = buf.extractString();
+ const char *name = buf.extractChars();
Identifier *id = Identifier::idPool(name);
Initializer *ti;
{
OutBuffer buf;
stcToBuffer(&buf, stc);
- error("cannot be %s", buf.peekString());
+ error("cannot be %s", buf.peekChars());
}
storage_class &= ~stc; // strip off
}
{
OutBuffer buf;
stcToBuffer(&buf, stc);
- error("cannot be 'scope' and '%s'", buf.peekString());
+ error("cannot be 'scope' and '%s'", buf.peekChars());
}
else if (isMember())
{
buf.writestring("typeid(");
buf.writestring(tinfo->toChars());
buf.writeByte(')');
- return buf.extractString();
+ return buf.extractChars();
}
/***************************** TypeInfoConstDeclaration **********************/
buf2.reserve(32);
Mangler v(&buf2);
v.paramsToDecoBuffer(t->arguments);
- const char *s = buf2.peekString();
+ const char *s = buf2.peekChars();
int len = (int)buf2.offset;
buf->printf("%d%.*s", len, len, s);
}
OutBuffer buf;
Mangler v(&buf);
v.mangleExact(fd);
- fd->mangleString = buf.extractString();
+ fd->mangleString = buf.extractChars();
}
return fd->mangleString;
}
const char *m = (*ms)[j];
const char *q = strchr(m, '=');
assert(q);
- if (dotmods->offset <= (size_t)(q - m) && memcmp(dotmods->peekString(), m, q - m) == 0)
+ if (dotmods->offset <= (size_t)(q - m) && memcmp(dotmods->peekChars(), m, q - m) == 0)
{
buf->reset();
size_t qlen = strlen(q + 1);
}
}
buf.printf("%s\t(%s)", ident->toChars(), m->srcfile->toChars());
- message("import %s", buf.peekString());
+ message("import %s", buf.peekChars());
}
m = m->parse();
}
}
buf.writestring(id->toChars());
- return buf.extractString();
+ return buf.extractChars();
}
/* =========================== Package ===================== */
{
OutBuffer anc;
emitAnchorName(&anc, s, skipNonQualScopes(sc));
- ident = Identifier::idPool(anc.peekString());
+ ident = Identifier::idPool(anc.peekChars());
}
size_t *count = (size_t*)dmd_aaGet(&sc->anchorCounts, (void *)ident);
TemplateDeclaration *td = getEponymousParent(s);
else
buf.writestring("nothing");
- deprecation(loc, "%s", buf.peekString());
+ deprecation(loc, "%s", buf.peekChars());
}
Dsymbol *Scope::search_correct(Identifier *ident)
::toCBuffer(constraint, &buf, &hgs);
buf.writeByte(')');
}
- return buf.extractString();
+ return buf.extractChars();
}
Prot TemplateDeclaration::prot()
OutBuffer bufsa;
mangleToBuffer(sa, &bufsa);
- const char *s = bufsa.extractString();
+ const char *s = bufsa.extractChars();
/* Bugzilla 3043: if the first character of s is a digit this
* causes ambiguity issues because the digits of the two numbers are adjacent.
assert(0);
}
buf.writeByte('Z');
- id = buf.peekString();
+ id = buf.peekChars();
//printf("\tgenIdent = %s\n", id);
return Identifier::idPool(id);
}
{
OutBuffer buf;
toCBufferInstance(this, &buf);
- return buf.extractString();
+ return buf.extractChars();
}
const char *TemplateInstance::toPrettyCharsHelper()
{
OutBuffer buf;
toCBufferInstance(this, &buf, true);
- return buf.extractString();
+ return buf.extractChars();
}
/*************************************
{
OutBuffer buf;
toCBufferInstance(this, &buf);
- return buf.extractString();
+ return buf.extractChars();
}
{
OutBuffer buf;
buf.printf("%d", level);
- return buf.extractString();
+ return buf.extractChars();
}
}
{
OutBuffer buf;
buf.printf("%d", level);
- return buf.extractString();
+ return buf.extractChars();
}
}
OutBuffer buf;
HdrGenState hgs;
toCBuffer(this, &buf, &hgs);
- return buf.extractString();
+ return buf.extractChars();
}
void Expression::error(const char *format, ...) const
MODMatchToBuffer(&ffbuf, ff->type->mod, v->type->mod);
MODMatchToBuffer(&vbuf, v->type->mod, ff->type->mod);
error("%s%s '%s' cannot access %sdata '%s'",
- ffbuf.peekString(), ff->kind(), ff->toPrettyChars(), vbuf.peekString(), v->toChars());
+ ffbuf.peekChars(), ff->kind(), ff->toPrettyChars(), vbuf.peekChars(), v->toChars());
err = true;
break;
}
const char *funcStr = fd->Dsymbol::toPrettyChars();
OutBuffer buf;
functionToBufferWithIdent((TypeFunction *)fd->type, &buf, funcStr);
- s = buf.extractString();
+ s = buf.extractChars();
}
else
{
MODMatchToBuffer(&thisBuf, e->e1->type->mod, tf->mod);
MODMatchToBuffer(&funcBuf, tf->mod, e->e1->type->mod);
e->error("%smethod %s is not callable using a %s%s",
- funcBuf.peekString(), f->toPrettyChars(), thisBuf.peekString(), e->e1->toChars());
+ funcBuf.peekChars(), f->toPrettyChars(), thisBuf.peekChars(), e->e1->toChars());
return setError();
}
}
//printf("tf = %s, args = %s\n", tf->deco, (*exp->arguments)[0]->type->deco);
::error(exp->loc, "%s %s %s is not callable using argument types %s",
p, exp->e1->toChars(), parametersTypeToChars(tf->parameterList),
- buf.peekString());
+ buf.peekChars());
return setError();
}
//printf("tf = %s, args = %s\n", tf->deco, (*exp->arguments)[0]->type->deco);
::error(exp->loc, "%s %s is not callable using argument types %s",
exp->e1->toChars(), parametersTypeToChars(tf->parameterList),
- buf.peekString());
+ buf.peekChars());
exp->f = NULL;
}
}
OutBuffer buf;
mangleToBuffer(ds, &buf);
- const char *s = buf.extractString();
+ const char *s = buf.extractChars();
Expression *e = new StringExp(exp->loc, const_cast<char*>(s), strlen(s));
e = semantic(e, sc);
return e;
{
OutBuffer buf;
MODtoBuffer(&buf, tf->mod);
- error("without 'this' cannot be %s", buf.peekString());
+ error("without 'this' cannot be %s", buf.peekChars());
tf->mod = 0; // remove qualifiers
}
MODMatchToBuffer(&thisBuf, tthis->mod, tf->mod);
MODMatchToBuffer(&funcBuf, tf->mod, tthis->mod);
::error(loc, "%smethod %s is not callable using a %sobject",
- funcBuf.peekString(), this->toPrettyChars(), thisBuf.peekString());
+ funcBuf.peekChars(), this->toPrettyChars(), thisBuf.peekChars());
}
}
{
::error(loc, "%s %s.%s cannot deduce function from argument types !(%s)%s, candidates are:",
td->kind(), td->parent->toPrettyChars(), td->ident->toChars(),
- tiargsBuf.peekString(), fargsBuf.peekString());
+ tiargsBuf.peekChars(), fargsBuf.peekChars());
// Display candidate templates (even if there are no multiple overloads)
TemplateCandidateWalker tcw;
else if (od)
{
::error(loc, "none of the overloads of '%s' are callable using argument types !(%s)%s",
- od->ident->toChars(), tiargsBuf.peekString(), fargsBuf.peekString());
+ od->ident->toChars(), tiargsBuf.peekChars(), fargsBuf.peekChars());
}
else
{
MODMatchToBuffer(&funcBuf, tf->mod, tthis->mod);
if (hasOverloads)
::error(loc, "none of the overloads of '%s' are callable using a %sobject, candidates are:",
- fd->ident->toChars(), thisBuf.peekString());
+ fd->ident->toChars(), thisBuf.peekChars());
else
::error(loc, "%smethod %s is not callable using a %sobject",
- funcBuf.peekString(), fd->toPrettyChars(), thisBuf.peekString());
+ funcBuf.peekChars(), fd->toPrettyChars(), thisBuf.peekChars());
}
else
{
//printf("tf = %s, args = %s\n", tf->deco, (*fargs)[0]->type->deco);
if (hasOverloads)
::error(loc, "none of the overloads of '%s' are callable using argument types %s, candidates are:",
- fd->ident->toChars(), fargsBuf.peekString());
+ fd->ident->toChars(), fargsBuf.peekChars());
else
fd->error(loc, "%s%s is not callable using argument types %s",
parametersTypeToChars(tf->parameterList),
tf->modToChars(),
- fargsBuf.peekString());
+ fargsBuf.peekChars());
}
// Display candidate functions
::error(loc, "%s.%s called with argument types %s matches both:\n"
"%s: %s%s\nand:\n%s: %s%s",
s->parent->toPrettyChars(), s->ident->toChars(),
- fargsBuf.peekString(),
+ fargsBuf.peekChars(),
m.lastf->loc.toChars(), m.lastf->toPrettyChars(), lastprms,
m.nextf->loc.toChars(), m.nextf->toPrettyChars(), nextprms);
}
{
OutBuffer buf;
functionToBufferWithIdent(type->toTypeFunction(), &buf, toChars());
- return buf.extractString();
+ return buf.extractChars();
}
bool FuncDeclaration::isMain()
{
OutBuffer buf;
buf.printf("__unittestL%u_", loc.linnum);
- return Identifier::generateId(buf.peekString());
+ return Identifier::generateId(buf.peekChars());
}
UnitTestDeclaration::UnitTestDeclaration(Loc loc, Loc endloc, StorageClass stc, char *codedoc)
HdrGenState hgs;
PrettyPrintVisitor v(&buf, &hgs);
v.parametersToBuffer(pl.parameters, pl.varargs);
- return buf.extractString();
+ return buf.extractChars();
}
buf.writestring(prefix);
buf.printf("%llu", (ulonglong)i);
- char *id = buf.peekString();
+ char *id = buf.peekChars();
return idPool(id);
}
OutBuffer buf;
HdrGenState hgs;
::toCBuffer(this, &buf, &hgs);
- return buf.extractString();
+ return buf.extractChars();
}
/********************************** ErrorInitializer ***************************/
OutBuffer buf;
buf.reserve(16);
MODtoBuffer(&buf, mod);
- return buf.extractString();
+ return buf.extractChars();
}
/********************************
hgs.fullQual = (ty == Tclass && !mod);
::toCBuffer(this, &buf, NULL, &hgs);
- return buf.extractString();
+ return buf.extractChars();
}
char *Type::toPrettyChars(bool QualifyTypes)
hgs.fullQual = QualifyTypes;
::toCBuffer(this, &buf, NULL, &hgs);
- return buf.extractString();
+ return buf.extractChars();
}
/*********************************
OutBuffer buf;
buf.reserve(16);
modToBuffer(&buf);
- return buf.extractString();
+ return buf.extractChars();
}
/** For each active modifier (MODconst, MODimmutable, etc) call fp with a
OutBuffer buf2; stcToBuffer(&buf2, stc2);
error(loc, "incompatible parameter storage classes '%s' and '%s'",
- buf1.peekString(), buf2.peekString());
+ buf1.peekChars(), buf2.peekChars());
errors = true;
stc = stc1 | (stc & ~(STCref | STCout | STClazy));
}
if (e)
{
buf1.printf("(%s)", e->toChars());
- s1 = buf1.peekString();
+ s1 = buf1.peekChars();
}
error("redundant alignment attribute align%s", s1);
}
OutBuffer buf;
stcToBuffer(&buf, stc);
if (deprec)
- deprecation("redundant attribute '%s'", buf.peekString());
+ deprecation("redundant attribute '%s'", buf.peekChars());
else
- error("redundant attribute '%s'", buf.peekString());
+ error("redundant attribute '%s'", buf.peekChars());
return storageClass | stc;
}
{
OutBuffer buf;
stcToBuffer(&buf, modStc);
- error(loc, "static constructor cannot be %s", buf.peekString());
+ error(loc, "static constructor cannot be %s", buf.peekChars());
}
stc &= ~(STCstatic | STC_TYPECTOR);
{
OutBuffer buf;
stcToBuffer(&buf, modStc);
- error(loc, "static destructor cannot be %s", buf.peekString());
+ error(loc, "static destructor cannot be %s", buf.peekChars());
}
stc &= ~(STCstatic | STC_TYPECTOR);
{
OutBuffer buf;
stcToBuffer(&buf, modStc);
- error(loc, "shared static constructor cannot be %s", buf.peekString());
+ error(loc, "shared static constructor cannot be %s", buf.peekChars());
}
stc &= ~(STCstatic | STC_TYPECTOR);
{
OutBuffer buf;
stcToBuffer(&buf, modStc);
- error(loc, "shared static destructor cannot be %s", buf.peekString());
+ error(loc, "shared static destructor cannot be %s", buf.peekChars());
}
stc &= ~(STCstatic | STC_TYPECTOR);
{
OutBuffer buf;
stcToBuffer(&buf, modStc);
- error("function literal cannot be %s", buf.peekString());
+ error("function literal cannot be %s", buf.peekChars());
}
else
save = TOKdelegate;
}
if (buf.offset) // if path is not empty
{
- array->push(buf.extractString());
+ array->push(buf.extractChars());
}
} while (c);
}
this->offset -= nbytes;
}
-char *OutBuffer::peekString()
+char *OutBuffer::peekChars()
{
if (!offset || data[offset-1] != '\0')
{
return (char *)data;
}
-char *OutBuffer::extractString()
+char *OutBuffer::extractChars()
{
if (!offset || data[offset-1] != '\0')
writeByte(0);
size_t insert(size_t offset, const void *data, size_t nbytes);
void remove(size_t offset, size_t nbytes);
// Append terminating null if necessary and get view of internal buffer
- char *peekString();
+ char *peekChars();
// Append terminating null if necessary and take ownership of data
- char *extractString();
+ char *extractChars();
};
OutBuffer buf;
buf.printf("%s%s", prefix, ident->toChars());
- const char *name = buf.extractString();
+ const char *name = buf.extractChars();
ident = Identifier::idPool(name);
}
return ident;
OutBuffer buf;
::toCBuffer(this, &buf, &hgs);
- return buf.extractString();
+ return buf.extractChars();
}
buf.writeByte('"');
if (postfix)
buf.writeByte(postfix);
- p = buf.extractString();
+ p = buf.extractChars();
}
break;
OutBuffer buf;
mangleToBuffer (fd->type, &buf);
- tdeco = buf.extractString ();
+ tdeco = buf.extractChars ();
}
/* Matching the type deco may be a bit too strict, as it means that all