[cfe-dev] rewriting types of function declarations

Stephan Creutz stephan.creutz at inf.tu-dresden.de
Fri Jun 6 06:41:41 PDT 2008

Hi Chris!

On Mon, Jun 02, 2008 at 10:50:30PM -0700, Chris Lattner wrote:
> On Jun 2, 2008, at 6:14 AM, Stephan Creutz wrote:
>> is it possible to rewrite types in function declarations or better in
>> named declarations? It seems there is no location information available
>> for types.
> Hi Stephan,
> You're right that types don't have location information.  Since they are 
> unique'd, there is a many to one mapping between type instances and the 
> underlying type.  It would be possible to capture this information, but 
> would be extremely expensive.
> For most uses, a fuzzy scanning technique can be used to find the locations 
> you need in the original source.  Given a source location for the 
> paramdecl, for example, you can get a "const char*" into the original 
> source code and scan from there with strchr etc.  This is what the objc 
> rewriter does in many cases.

Thank you for that hint. I think that approach is sufficient for me (for

But at which point the location information is thrown away? Would it
help to subclass Action or or better Sema to get this kind of
information (just for the case I get further problems)?


More information about the cfe-dev mailing list