如何使用 libClang 解析函数属性?

Pro*_*ain 5 c++ libclang

我正在尝试使用 libClang 解析函数属性,但到目前为止还没有成功。

例如,我可能在标题中定义了这样的属性。

#define __mobile__ __attribute__((mobile))
Run Code Online (Sandbox Code Playgroud)

在一个单独的 .cpp 文件中,我有我的函数定义:

<template T>
__mobile__ void run(T int){...}
Run Code Online (Sandbox Code Playgroud)

我花了一天时间玩弄 libClang 库并通过它与 C++ 进行交互。

到目前为止,我还无法判断该函数是否包含这样的属性。方法 clang_Cursor_hasAttrs 为游标运行返回 0,这是 CXCursor_FunctionTemplate 类型。