[cfe-dev] FunctionDecls by typedef crash the C++ front-end
Doug Gregor
doug.gregor at gmail.com
Fri Oct 24 07:43:47 PDT 2008
On Fri, Oct 24, 2008 at 12:10 AM, Argiris Kirtzidis <akyrtzi at gmail.com> wrote:
> Chris Lattner wrote:
>>
>> Two options here. The best is probably for the C++ front-end to create
>> the parm var decls in this case, to be consistent with "void f(int);". The
>> typedef shouldn't affect the AST generated other than the pretty type.
>
> If the C++ front-end could be changed to handle the no-parmvardecl case, it
> would also work in the case that not producing them is common.
Yes.
> In general I think there should be some convention, whether they are
> produced or not should be the same for both front-ends. Producing them for
> C++ and not for C is more confusing.
I think Argiris is voicing an important principle here: regardless of
what dialect we're parsing, we should produce ASTs of the same form.
Having the ParmVarDecls or not shouldn't be a C-vs-C++ decision, but
there could be a function-definition-vs-non-function-definition
decision. Sometimes the same syntax has different interpretations in
different dialects---"void f();" in C vs. C++, for example---but the
notion of a function "f" with no prototype or of a function f" that
accepts no arguments and has a void return type is always the same in
the AST.
- Doug
More information about the cfe-dev
mailing list