[cfe-dev] get predefined typedefs and vars

Chris Lattner clattner at apple.com
Wed Jun 9 09:21:34 PDT 2010


On Jun 9, 2010, at 3:47 AM, Maximilian Odendahl wrote:

> Hi,
> 
> I'm using a decl_iterator to loop over Decl::Vars and Decl::Typedefs and 
> printing them to a file.
> 
> Is there a way to find out if this Var or Typedef was already predefined 
> or actually coming from my parsed source file?

The best way to do this is to use the SourceManager::isFromMainFile method, which tells you if a source location is in the main file.  Note that you'll probably want to pass in an instantiation location to handle things with macros.

-Chris

> 
> So I do not want to dump stuff such as
> 
> extern char* __tzname[2] or
> 
> typedef unsigned long __u_quad_t
> 
> 
> Thanks for your help,
> Max
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list