From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3930 invoked by alias); 12 Oct 2015 12:33:02 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 2182 invoked by uid 89); 12 Oct 2015 12:33:01 -0000 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 Received: from proxy.razorcat.de (HELO proxy.razorcat.com) (213.23.173.139) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 12 Oct 2015 12:32:59 +0000 Received: from [192.168.0.232] (Mimir.ats-berlin.de [192.168.0.232]) by proxy.razorcat.com (8.13.8+Sun/8.13.7) with ESMTP id t9CCWtSg028149 for ; Mon, 12 Oct 2015 14:32:55 +0200 (CEST) To: cygwin@cygwin.com From: Frank Redeker Subject: Life time of AST elements. Message-ID: <561BA976.6050405@razorcat.de> Date: Mon, 12 Oct 2015 12:33:00 -0000 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 X-SW-Source: 2015-10/txt/msg00134.txt.bz2 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