[cfe-dev] What code generates default constructors?
David Blaikie via cfe-dev
cfe-dev at lists.llvm.org
Tue Jan 22 12:54:51 PST 2019
I tend to use a debugger to help with these sort of things too - create an
example that involves invoking a default ctor, break in
CXXConstructorDecl's ctor, and run the program to see where that's invoked
from.
On Tue, Jan 22, 2019 at 5:17 AM Bruno Ricci via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> I am not sure I understand the question, but in general one way I found to
> be
> useful to know what piece of code creates which AST node is to grep for
> eg: StringLiteral::Create, or StringLiteral and new. In this case what you
> are
> looking for is CXXConstructorDecl::Create, which gives a few matches.
>
> In particular Sema::DeclareImplicitDefaultConstructor seems to be what you
> want.
> The other matches in SemaDeclCXX are for the other implicitely declared
> constructors.
>
> Bruno
>
> On 22/01/2019 11:48, Gregory Malecha via cfe-dev wrote:
> > Hello --
> >
> > I'm trying to understand how ASTs for constructors are generated when
> they are referenced. In particular, I'm working on a libtooling tool that
> will dump the AST to another format on a per-file basis so I need to know
> the code for any constructors even if they are not called in the file.
> >
> > Very concretely, if I write the following code:
> >
> > class P {};
> > int main() {
> > P x;
> > return 0;
> > }
> >
> > the result of -ast-dump will contain the implementation of the default
> constructor (not very interesting in this case). What code generates this?
> >
> > Thank you.
> >
> > --
> > gregory malecha
> > gmalecha.github.io <https://gmalecha.github.io>
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> >
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190122/ca74acda/attachment.html>
More information about the cfe-dev
mailing list