public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Life time of AST elements.
@ 2015-10-12 12:33 Frank Redeker
  2015-10-12 12:36 ` Frank Redeker
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Redeker @ 2015-10-12 12:33 UTC (permalink / raw)
  To: cygwin

Hello all,

I'm writing a tool to analyze the call hierarchy of functions (methods)
using ClangTool.

My idea is to collect the TranslationUnitDecls given to my own
ASTCosumer's HandleTranslationUnit method and traverse them later when
ClangTool.run() has finished.

But it seems that the AST nodes are no longer valid after
ClangTool.run() has returned. (e.g. If I call getQualifiedNameAsString()
on a FunctionDecl object retrieved from the TranslationUnitDecl, I get
`Assertion failed: DC && "This decl is not contained in a translation
unit!"`)

So I wonder if there is any trick to extend the life time for the AST or
should I use ClangTool.buildAST() rather then ClangTool.run() to get the
ASTs ?


Frank

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Life time of AST elements.
  2015-10-12 12:33 Life time of AST elements Frank Redeker
@ 2015-10-12 12:36 ` Frank Redeker
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Redeker @ 2015-10-12 12:36 UTC (permalink / raw)
  To: cygwin

Am 12.10.2015 um 14:37 schrieb Frank Redeker:
> Hello all,
> 
> I'm writing a tool to analyze the call hierarchy of functions (methods)
> using ClangTool.
> 
> My idea is to collect the TranslationUnitDecls given to my own
> ASTCosumer's HandleTranslationUnit method and traverse them later when
> ClangTool.run() has finished.
> 
> But it seems that the AST nodes are no longer valid after
> ClangTool.run() has returned. (e.g. If I call getQualifiedNameAsString()
> on a FunctionDecl object retrieved from the TranslationUnitDecl, I get
> `Assertion failed: DC && "This decl is not contained in a translation
> unit!"`)
> 
> So I wonder if there is any trick to extend the life time for the AST or
> should I use ClangTool.buildAST() rather then ClangTool.run() to get the
> ASTs ?
> 
Sorry,

wrong mailing list!


Frank


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-12 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 12:33 Life time of AST elements Frank Redeker
2015-10-12 12:36 ` Frank Redeker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).