is there any existing facility for looking up function declarations by their name, label list and type, and if not, what would be the best way to implement it and what to look out for?
I'm working on extending SourceKit, and I've stumbled upon an issue with the CursorInfo request.
Basically, the CursorInfo request allows you to find a declaration not only by the position of a reference of that declaration in the source code, but also by its USR (which AFAIU is effectively its mangled name with the
$s prefix replaced by
What I've found is that right now you can only do that with type declarations. I. e. if you want to find a function declaration, or generic type parameter declaration (which is what I initially wanted to get) by its USR, you're out of luck.
So I've started working on extending the demangler to support lookup for these kinds of declarations. The first step, I figured, is to teach the demangler to find function declarations by their mangled names.
I've learned how to extract info from a function's mangled name like declaring module, name, label list, and type. (While we're at it, I've implemented an LLDB data formatter that greatly simplified working with mangle nodes, please take a look.)
Now what I want to do is to look up the matching function in that module.
So, my question is: is there any existing facility for looking up function declarations by their name, label list and type, and if not, what would be the best way to implement it and what to look out for?
(What I want is something akin to
ASTBuilder::findTypeDecl, but for functions.)