1

What I am doing is I want to use libclang to parse a c++ head file then get AST to find structs and describe their formats as,

struct 0 name,field 0 name,field 0 offset,field 1 name,field 1 offset, ...

struct 1 name,field 0 name,field 0 offset,field 1 name,field 1 offset, ...

I am using cursor::get_field_offsetof to get offsets. But got some issue with types as uint64_t

struct issue
{
   int a;
   uint64_t b;
};

// cursor::get_field_offsetof always returns -1 

struct no_issue
{
   int a;
   long long b;
};

//  can return correct offsets

It looks like uint64_t is not understood by libclang 3.9. The argument I used for parsing is ['x','c++','-std=c++11']

Any suggestions are welcome.

Cheers

DAG
  • 417
  • 4
  • 7
  • Did you include [cstdint](http://en.cppreference.com/w/cpp/header/cstdint)? Did you check whether libclang produced any diagnostics? – Andrew Walker Sep 22 '16 at 08:00

0 Answers0