Hi everybody. I found that there are some problems with symbol location in AsmParser.
1. We need to know where symbol was declared.
2. We need to know where symbol was defined first time.
There are two ways:
1. Add helper table to the parser with additional symbol info. But it takes additional memory consumption.
2. Add user tag (void*) for MCSymbol object. As I understood MCSymbol can live without asm sources, so we can't add info field directly. But the user tags is pretty common practice for this cases.
So, what are you think about it?
Now I see, that its to so trivial as I thought before. There are a lots of parser extensions that creates the symbols. And in each place we need insert add its location info. I also found that MCContext has several create symbols methods, but all these methods uses CreateSymbol private method.
So I see two possible ways here:
1. To aggregate all GetOrCreate-like symbol methods inside the AsmParser. So all asm parser extension like a COFFAsmParser should use aggregated methods instead of MCContext ones. And inside the aggregated methods we can add symbol location info.
2. Add create-symbol event to the MCContext. So each time when symbol will created by the MCContext::CreateSymbol this event will be fired. We can process this event by adding symbol location info to some AsmParser internal table for example.
I mean "not so trivial" sorry )