libclang を使用して C++ の名前空間関数の本体を解析できません。
次のような名前空間にクラスがあります。
namespace outer {
namespace inner {
class MyClass {
public:
short myMethod(){
return NTOHS(10);
}
short anotherMethod();
};
short MyClass::anotherMethod(){
return NTOHS(11);
}
short myFunction(){
return NTOHS(12);
}
}
}
libclang の Python ラッパーを使用すると、再帰によって各ノードを見つけることができます。
def find_node(node):
print node # Just print stuff about the node (spelling, location, etc.)
for child in node.get_children():
find_node(child)
myMethod
およびで NTOHS の使用を検出し、myFunction
それらのノードに関する情報を出力できますが、 では検出できませんMyClass::anotherMethod
。
他の誰かが同様の問題に遭遇しましたが、解決されていないようです。
ここでの NTOHS は、ネットワークをホストの順序に変換するための linux/unix コマンドです。
libclang を使用して名前空間関数で NTOHS を検出するにはどうすればよいですか?