diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-07 16:50:46 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-07 16:50:46 +0200 |
commit | c3a2ba10b272fd9581560604284da2a6283bcde0 (patch) | |
tree | 9ecb66c15a440f670f9cfdccbc04c2a6e76f8cef /gcc/d/dmd/escape.c | |
parent | 5aaccde3db39fac7e7f6677ceccc1eadd9c6a424 (diff) | |
download | gcc-c3a2ba10b272fd9581560604284da2a6283bcde0.zip gcc-c3a2ba10b272fd9581560604284da2a6283bcde0.tar.gz gcc-c3a2ba10b272fd9581560604284da2a6283bcde0.tar.bz2 |
d: Merge upstream dmd b0df0e982
Adds a struct ParameterList to encapulate parameter and vararg
information in the front-end.
Reviewed-on: https://github.com/dlang/dmd/pull/11226
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd b0df0e982.
* d-builtins.cc (build_frontend_type): Use VarArg for varargs_p.
* d-codegen.cc (declaration_type): Call TypeFunction::create with
argument VARARGnone.
(parameter_type): Likewise.
(d_build_call): Use new field names and member functions.
* d-target.cc (Target::cppParameterType): Call TypeFunction::create
with argument VARARGnone.
* types.cc (TypeVisitor::visit (TypeFunction *): Use new field names
and member functions.
Diffstat (limited to 'gcc/d/dmd/escape.c')
-rw-r--r-- | gcc/d/dmd/escape.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/d/dmd/escape.c b/gcc/d/dmd/escape.c index df43a7f..b3fccd9 100644 --- a/gcc/d/dmd/escape.c +++ b/gcc/d/dmd/escape.c @@ -707,12 +707,12 @@ static void inferReturn(FuncDeclaration *fd, VarDeclaration *v) else { // Perform 'return' inference on parameter - if (tf->ty == Tfunction && tf->parameters) + if (tf->ty == Tfunction) { - const size_t dim = Parameter::dim(tf->parameters); + const size_t dim = tf->parameterList.length(); for (size_t i = 0; i < dim; i++) { - Parameter *p = Parameter::getNth(tf->parameters, i); + Parameter *p = tf->parameterList[i]; if (p->ident == v->ident) { p->storageClass |= STCreturn; @@ -950,14 +950,14 @@ static void escapeByValue(Expression *e, EscapeByResults *er) /* j=1 if _arguments[] is first argument, * skip it because it is not passed by ref */ - size_t j = (tf->linkage == LINKd && tf->varargs == 1); + size_t j = tf->isDstyleVariadic(); for (size_t i = j; i < e->arguments->length; ++i) { Expression *arg = (*e->arguments)[i]; - size_t nparams = Parameter::dim(tf->parameters); + size_t nparams = tf->parameterList.length(); if (i - j < nparams && i >= j) { - Parameter *p = Parameter::getNth(tf->parameters, i - j); + Parameter *p = tf->parameterList[i - j]; const StorageClass stc = tf->parameterStorageClass(p); if ((stc & (STCscope)) && (stc & STCreturn)) arg->accept(this); @@ -1146,15 +1146,15 @@ static void escapeByRef(Expression *e, EscapeByResults *er) /* j=1 if _arguments[] is first argument, * skip it because it is not passed by ref */ - size_t j = (tf->linkage == LINKd && tf->varargs == 1); + size_t j = tf->isDstyleVariadic(); for (size_t i = j; i < e->arguments->length; ++i) { Expression *arg = (*e->arguments)[i]; - size_t nparams = Parameter::dim(tf->parameters); + size_t nparams = tf->parameterList.length(); if (i - j < nparams && i >= j) { - Parameter *p = Parameter::getNth(tf->parameters, i - j); + Parameter *p = tf->parameterList[i - j]; const StorageClass stc = tf->parameterStorageClass(p); if ((stc & (STCout | STCref)) && (stc & STCreturn)) arg->accept(this); |