Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CDT API Forum and ASTVisitor
  • From: Ming Cheng <chengm349@xxxxxxxxxxx>
  • Date: Sat, 9 May 2020 03:44:41 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iKux0c9k+6ZKQ7PWtfsTRikEKHAbjd8y814LXv4mo80=; b=bxkwIDruQxitYJDikH0cUNpTnfwuQL4SCHgMa6F4s1WbeBslgYhu6ksX2I3bs4AUEa2yUBSFrMS/DUg+ETls2CDOJYRiUoSxAL+SUZ2qOtq1jWz7cgDmInR2E6pOJbUQsI+nNvHpkUh9yuSXs8VwFI+4xVU8kwwd3K4iq8/ongs6mEuGZ7FUdpRgCXBuR29sDLAjGBpoZ8cgmmQncRed0HR1an43EXO4CGJj6Zmu7+ikPlXronu9s59G7Hujb6Tux/Tn7SHJs0alu8tmnCU84jfoIf9YbEVApMko5aTXZOR+I8AlVJmKZyU4b5CYtUCnWH4OOunsZRdLIMQKnBE7xw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OuLKTLeDy1Bma9EHV9QeDJ/n2fcnOKr3xVNUopFe0NaBfNtJ4akWcnIhGeFyCQG2U/XKdgOiplVVG3V78JrDpUy3fMI24YpnTjO6GtR3f/aE+T9IZbEY8Ggxv0kuTaqOVFcbJpwFhd2GtEKSOWcdXeciF2+dzxDSmsXsfoTEhjpnNQr/f+ce/h564BbThlDeG1eL1PIeTMdkRkpk3RJsbw4hE41VdCtX8AINZpxbkDLhKR1csBZzcmLC5HwJaOwEr08okhIi3U3JOFn9Wgg6Vy3y1l+027zy6PkBxx8B+p06WkWjlZKuP3S0PnROZbsUPiAi0zfCRCFrecHVQ1fK5g==
  • Delivered-to: cdt-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cdt-dev>
  • List-help: <mailto:cdt-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHWJQ8jJpAE7A9uf0KDwwBJcP0znqieKE0AgAAgcgCAANNTwA==
  • Thread-topic: [cdt-dev] CDT API Forum and ASTVisitor

Hi Corbat,
Thanks for your tips and help. AST_SKIP_ALL_HEADERS is what I need.


From: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> on behalf of Corbat Thomas <thomas.corbat@xxxxxx>
Sent: Friday, May 8, 2020 3:00 PM
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] CDT API Forum and ASTVisitor
 

It depends on how the translation unit is parsed. If you parse the complete unit, the includes are resolved and you receive a full AST. You can configure how the AST is created by supplying parse options to the getAST() method (the overload taking an index and the option flags). You probably want the option AST_SKIP_ALL_HEADERS.


I hope this helps!


Von: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> im Auftrag von Jan Baeyens <jan@xxxxxxxxxx>
Gesendet: Freitag, 8. Mai 2020 15:04:30
An: cdt-dev@xxxxxxxxxxx
Betreff: Re: [cdt-dev] CDT API Forum and ASTVisitor
 

Though I'm not qualified to make any statements/remarks I feel very strongly to throw in my "2 cent architectural view"

Though it is not clear from the code I think you are querying the indexer "about the file XYZ.h".

>From that point of view it is expected that the indexer also parses the included files (like ABC.h) and returns results from included files.


in short: IMHO  XYZ.h is a entry point (known by XYZ.h) and not a filter (is in XYZ.h).


Best regards

Jantje


Op 8/05/2020 om 10:18 schreef Ming Cheng:
Hi All,

Seems there is no CDT API Forum. Please kindly let me know if there is one. Home » Language IDEs » C / C++ IDE (CDT) seems for IDE user.

Assume I have a header file XYZ.h and its content is:

#include "ABC.h"
class XYZ
{
....
}

My java processing code to this effect:

ITranslationUnit tu= (ITranslationUnit) CoreModel.getDefault().create(file);  // file here is XYZ.h
IASTTranslationUnit ast= tu.getAST();
ast.accept(new ASTVisitor());

It seems to me that the visitor also visit ABC.h file content which is out of my expectation.

Thanks.

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdt-dev

Back to the top