How to get (lowest) AST node for given location

Hi,

I have precise location information (source file name, offset/line+column number) and initialized CompilationDatabase (in RefactoringTool).
I want to get AST node for this location.

The problem I'm trying to solve is to answer question: "What is here?" in source code.

The other (but connected) question: Can I reuse AST nodes from different ClangTool invocations? (To such big extent to assume that addresses of these nodes can be compared)

This time we have node from the first question and want to use this node in second query.

Best Regards
Maciej Poleski

clang-rename/USRFinder.cpp in the tools-extra repo give you a rough idea how to do that…