c++ - libclang how one C compiler understand system header of another C compiler? -


i want analyze c/c++ program source code written android. use libclang, , stuck on such code example:

typedef __builtin_va_list       __va_list; 

this code deep inside stdint.h (chain of 2 headers stdint.h lead code).

if run clang on such code produces such ast:

$ clang -cc1  -triple arm-linux-androideabi -ast-dump test.h  |-typedefdecl 0x5616087550a0 <<invalid sloc>> <invalid sloc> implicit referenced __builtin_va_list 'struct __va_list' | `-recordtype 0x561608754fe0 'struct __va_list' |   `-record 0x561608754f58 '__va_list' `-typedefdecl 0x561608755120 <test.h:1:1, col:33> col:33 __va_list '__builtin_va_list':'struct __va_list'   `-typedeftype 0x5616087550f0 '__builtin_va_list' sugar     |-typedef 0x5616087550a0 '__builtin_va_list'     `-recordtype 0x561608754fe0 'struct __va_list'       `-record 0x561608754f58 '__va_list' 

this ast means:

typedef      b; struct b {} typedef struct b  a; 

which nonsense, clang --target=android-arm-androideabi -c test.c compile such code without problem. not clear me how clang interpret code in particular case.

so algorithm deals "foreign" headers comes other compiler, not libc, stdint.h or stdarg.h in c parsers, if want know how other compiler interpret c code?

in case c/c++ program compiles gcc comes android ndk, , want parse code void f(int, va_list vp);, , know sizeof(va_list), , understand clang somehow, not clear how, remove own builtin types in flavor of gcc?

or know own internal types abi compatible gcc one, , ignore types start __ or _<capital letter>?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -