How to get handle to ASTContext from LLVM Pass?

I’m trying to write code that queries the Clang AST (from a LLVM Pass).
I want to fetch type info that is lost during lowering (pointee types of pointers).

Is it possible to get a handle to the Clang AST of the current LLVM module (or function) from a LLVM Pass?

LLVMContext doesn’t seem to have a handle to Clang’s ASTContext :crying_cat_face:

LLVM does not have any knowledge of Clang or Clang AST: the LLVM IR is fully standalone and you can’t recover this information.

1 Like

Thank you for your prompt response!

Hopefully, I think I might be able to infer the pointee type to some degree by inspecting llvm::Use of a given llvm::Value which is a pointer :smile_cat: