[cfe-dev] Written name of conversion operator

John McCall rjmccall at apple.com
Fri Jun 4 02:40:53 PDT 2010


On Jun 4, 2010, at 2:35 AM, Abramo Bagnara wrote:

> Il 04/06/2010 09:56, John McCall ha scritto:
>> On Jun 3, 2010, at 11:54 PM, Abramo Bagnara wrote:
>>> We have attempted to extract from AST the name of operator written in
>>> the source but we have failed:
>>> 
>>> - using the DeclarationName we get the "wrong" name each time the name
>>> is not the one of the canonical type
>>> 
>>> - using the TypeSourceInfo of CXXConversionDecl should be always correct
>>> for operator declaration, but it fails on operator call if the name
>>> specified in the call is different from the one in the declaration
>>> 
>>> Is there a know way to obtain the written name?
>> 
>> Unfortunately, no, and I'm not sure there's a straightforward way to make this possible, either.  Possibly some extra storage on a DeclRefExpr / UnresolvedExpr?
> 
> ... and also in the three kinds of MemberExpr :-(
> 
> I'd like to propose you a whole different approach: non canonical
> DeclarationName.

I considered this, but I think we really want to avoid it.  The major problem is lookup, where conversion functions (and only conversion functions) have to be hashed by a different value.  It's a very fundamental sort of thing to be messing around with and making less efficient just to preserve source information better.

John.



More information about the cfe-dev mailing list