[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] libclang 3.5 C interface - cannot get to macro definitions/expansions with cursors
From:       Matt Stevens via cfe-dev <cfe-dev () lists ! llvm ! org>
Date:       2015-11-30 22:05:34
Message-ID: 69DF5A3C-1D94-40C6-AE74-20923065AB2D () alloysoft ! com
[Download RAW message or body]


> On Nov 30, 2015, at 5:52 AM, Juaristi Álamos, Ander via cfe-dev \
> <cfe-dev@lists.llvm.org> wrote: 
> Hi all,
> 
> I'm writing a libclang-based C application to get information about
> functions, variables and macros, and should treat them all equally.
> 
> What I need is to be able to parse the macro definitions and expansions
> (before they are expanded), as if they were functions.
> 
> To test libclang, I've written a sample application that walks over the
> AST like this:
> 
> error = clang_parseTranslationUnit2(index, 0, argv, argc, 0, 0,
> CXTranslationUnit_None,
> &tu);
> if (tu) {
> cursor = clang_getTranslationUnitCursor(tu);
> clang_visitChildren(cursor, cx_visit, NULL);
> ...

Hi AJ,

To visit cursors for macro definitions and expansions pass the \
CXTranslationUnit_DetailedPreprocessingRecord option to \
clang_parseTranslationUnit2().

Matt
_______________________________________________
cfe-dev mailing list
cfe-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic