[cfe-dev] Constructor Initializers

Miguel Aguilar miguel.aguilar at ice.rwth-aachen.de
Tue Jan 29 01:20:18 PST 2013


Hi,

Any ideas on this issue???

Thanks

On 01/25/2013 05:07 PM, Miguel Aguilar wrote:
> Hi,
>
> I am trying to get the constructor initializers of the following class:
>
> PC::PC(const Id& n) :
>   ProcessNetwork(n),
>   fifo( id("fifo")),
>   prod( id("prod"), fifo),
>   cons( id("cons"), fifo)
> { }
>
> If I run the -ast-printer I get this:
>
> PC(const Id &n) : ProcessNetwork(n), fifo(this->id("fifo")) {
> }
>
> which is clearly incomplete compared to the original code.
>
> Now my main interested is to analyze the constructor initializers, so 
> for that I have this code:
>
> bool VisitCXXRecordDecl(CXXRecordDecl *Declaration) {
>
>             for (CXXRecordDecl::ctor_iterator ctor = 
> Declaration->ctor_begin(),
>                         ctorEnd = Declaration->ctor_end(); ctor != 
> ctorEnd; ++ctor) {
>                 llvm::outs() << "Ctor name: " << 
> ctor->getNameAsString() << "\n";
>                 llvm::outs() << "Initializers: " << 
> ctor->getNumCtorInitializers() << "\n";
>             }
>
> }
>
> However, the getNumCtorInitializers() is always returning 0. Any ideas 
> what is wrong here?
>
> Thanks in advanced,
>
> Miguel
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list