Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Getting ahold of Pound Defines (#define)
Getting ahold of Pound Defines (#define) [message #219910] Mon, 21 July 2008 14:59 Go to next message
Eclipse UserFriend
Originally posted by: gang.xu.delphi.com

So I've written a function parser that will identify input and output
variables given a string (like body of a function), and I have added
support for ignoring commented out code.

Pound defines, however, are a different problem entirely. Where and how,
in the CDT model, can I find the pound defines?

I tried looking in the IASTDeclaration[] array obtained from a CFile as an
ITranslationUnit, but it was not there (only variable and function
definitions).

ITranslationUnit cFile = (ITranslationUnit)elem;
//try this code:
IASTDeclaration[] decl = cFile.getAST().getDeclarations();

So, I'm wondering-how the heck do I find these pound defines so I know
when to filter them out?
Re: Getting ahold of Pound Defines (#define) [message #220378 is a reply to message #219910] Thu, 24 July 2008 09:56 Go to previous message
Eclipse UserFriend
Dan Xu wrote:
> So I've written a function parser that will identify input and output
> variables given a string (like body of a function), and I have added
> support for ignoring commented out code.
>
> Pound defines, however, are a different problem entirely. Where and how,
> in the CDT model, can I find the pound defines?
>
> I tried looking in the IASTDeclaration[] array obtained from a CFile as
> an ITranslationUnit, but it was not there (only variable and function
> definitions).
>
> ITranslationUnit cFile = (ITranslationUnit)elem;
> //try this code:
> IASTDeclaration[] decl = cFile.getAST().getDeclarations();
>
> So, I'm wondering-how the heck do I find these pound defines so I know
> when to filter them out?
>

How about
org.eclipse.cdt.core.dom.ast.IASTTranslationUnit.getAllPrepr ocessorStatements()?

--
Anton Leherbauer
Wind River Systems, Austria
CDT Committer - http://www.eclipse.org/cdt
DSDP/DD Committer - http://www.eclipse.org/dsdp/dd
Previous Topic:Why no response?
Next Topic:Error launching external scanner info generator
Goto Forum:
  


Current Time: Tue Jul 29 12:18:09 EDT 2025

Powered by FUDForum. Page generated in 0.55917 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top