X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:message-id:date:mime-version
	:content-type:content-transfer-encoding; q=dns; s=default; b=XIY
	I31ricDX8nblqj4BAhLaMpE5c/nj3KSkNELnmByvCgdvhowlJRi+aYkf1m2RTc1z
	qbmaLaIguGRPssDDaxAKJS5BBMQ90uBU7WVitlodyGpdtlXAYOVx8KwkdlwMYUpf
	bFZDp9z4mr49uhxol/L7G5Y8wSRDzOqsz306dQkM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:message-id:date:mime-version
	:content-type:content-transfer-encoding; s=default; bh=LxDgQNqV/
	85gv1Q4OQo9QrnYp+w=; b=keusEQGVPSc/ny72ix/sB4iuFadjWAgJgnMXEtqPc
	vkEqTLY8qxyr2enPOHAC6+h0uUUWwwgGcwf1/gbFPqBU5CnGkhzcAusa0mldPDeD
	vGTbwO5TW5/JE9JLGKfc62S7XQnlhruyNVE5knnxOfCDVja9FZ8Oj4WURwhDheWh
	8s=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2
X-HELO: proxy.razorcat.com
To: cygwin@cygwin.com
From: Frank Redeker <f.redeker@razorcat.de>
Subject: Life time of AST elements.
Message-ID: <561BA976.6050405@razorcat.de>
Date: Mon, 12 Oct 2015 14:37:10 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

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

