libclang3.9python绑定中get\ field\ offsetof不适用于uint64_

2024-04-25 09:55:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我要做的是使用libclang解析一个c++头文件,然后让AST找到结构体,并将其格式描述为

结构0名称,字段0名称,字段0偏移量,字段1名称,字段1偏移量。。。你知道吗

结构1名称,字段0名称,字段0偏移量,字段1名称,字段1偏移量。。。你知道吗

我使用cursor::get\u field\u offsetof来获取偏移量。但是在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

看起来uint64\t不被libclang 3.9所理解。 我用于解析的参数是['x','c++','-std=c++11']

欢迎提出任何建议。你知道吗

干杯


Tags: 名称fieldget头文件issueast结构cursor