Hi,
Recently I’m using libClang to write a parser for my project. However, when libClang traverses a .cpp file, it introduces a lot of nodes that are not literally related to the source code, e.g. NamespaceDecl
from the template libraries, FunctionDecl
from the gcc thread translation unit, etc., which make sense but I don’t want to include in my analysis (I only need to analyze some superficial information in the source code in my project).
I managed to filter out a lot of NamespaceDecl
and LinkageSpecDecl
nodes by checking the Kind of cursors, but there are still some FunctionDecl
nodes that behave as semantic nodes in the AST (I hope I understand correctly) that hinder my analysis.
As I understand it (and there may be a misunderstanding), syntactic nodes, that is, nodes that behave in the AST as `-FunctionDecl[…] and not |-FunctionDecl must come from the source file, which is what I need to analyze.
Is there any way to distinguish between these two types of nodes? Or do I need to use a more advanced Clang tool to do this type of analysis? Or, is there any way to tell if a node is literally from the source file?