[cfe-dev] Written name of conversion operator

Abramo Bagnara abramo.bagnara at gmail.com
Fri Jun 4 14:38:21 PDT 2010


Il 04/06/2010 22:52, Douglas Gregor ha scritto:
> I have a different idea of how to address this issue, for which I had previously filed this bug report:
> 
> 	http://llvm.org/bugs/show_bug.cgi?id=6357
> 
> Essentially, it suggests adding a DeclarationNameLoc type that, similarly to TypeLoc, contains information about the exact spelling of and the source locations for a declaration name. DeclarationNameLoc should remain small (IdentifierInfo* + SourceLocation for the common case), and use separate storage when we need to store extra information (e.g., a conversion operator would refer to the TypeSourceInfo * of the conversion type as written). 
> 
> There would have to be a way---probably via the ASTContext---to extract a DeclarationName from a DeclarationNameLoc, for name-lookup purposes.
> 
> We would use DeclarationNameLoc within the ASTs (MemberExpr, DeclRefExpr, etc.) in lieu of DeclarationName.

You're more inclined toward:

struct DeclarationNameLoc {
  DeclarationName Name;
  char Extra[0];
};

and to have a field DeclarationNameLoc* NameLoc inside AST nodes

or

struct DeclarationNameLoc {
  DeclarationName Name;
  void* Extra;
};

and to have a field DeclarationNameLoc NameLoc inside AST nodes?

Another possibility is to have Extra data allocated at end of containing
node, but I think this might become too messy.



More information about the cfe-dev mailing list