Using MC Parser data

Hi, llvmdev!

I have some thoughts about using the LLVM MC Parser's data to extract
information about symbols like global data and 'functions' (labels with
code following) intermixed with preprocessor directives (for example a
C-like include file using function-like macros defined in the assembler
source code).

I'm looking at the MCContext class which is likely to own all
symbols in the file and all sections. However, I do not see whether
the MC parser gathers any data about source locations of parsed sections
and directives.

My question is whether it is possible to use MC to extract such data.
I guess, the first thing might be tracking the source locations (like
clang does), but what else can be a show-stopper?

Thank you

Hi Vladimir,

We don't have an MC backend that builds an "assembly AST", but it would be straight-forward to do so. Just define your own implementation of MCStreamer, and it will get called for every source level construct that the assembler runs into.