[cfe-dev] [Patch] AST support, and unqualified name lookup for using-directives

Douglas Gregor dgregor at apple.com
Sat Jan 31 12:42:41 PST 2009


On Jan 30, 2009, at 7:53 PM, Piotr Rak wrote:
> I have played bit more with using-directives. Attached adds AST
> support for using-directives (no serialization still), and makes
> Sema::LookupName look ugly:) I may split it into two separated
> patches(AST and lookup), if it is needed.

This is a big undertaking; thank you!

I'll do a detailed review later, but one thing in particular caught me  
eye: that sort_heap in CppLookupName is really going to hurt  
performance. Could you give me a short description of why we need it?  
(Or should I just wait until I do that detailed review to get the big  
picture?)

> I would also want to also ask, if there is any master plan how to get
> rid of OverloadedFunctionDecl yet, or anyone actively working on it
> now?

The master plan is for LookupResult to provide an easy way to iterate  
over the set of overloaded functions that it found, which means  
providing a LookupResult::iterator that understands how LookupResult  
stores overloaded functions (as a pair of iterators into a DeclContext  
or into an IdentifierResolver chain). If it would help with using- 
directives, I could implement LookupResult::iterator relatively soon.

Right now, OverloadedFunctionDecl is only created "on demand" by  
LookupResult when the caller requests a Decl*. Callers should be  
migrated to look at the kind of LookupResult they receive from  
Lookup*Name, so that they can handle both ambiguities and overloaded  
functions. This change can happen gradually, and at some point none of  
the callers will need OverloadedFunctionDecl. I haven't been actively  
working on doing this, but for the most part it also isn't hard. The  
trickiest part is deciding what to do with DeclRefExpr's that refer to  
overloaded functions.

	- Doug



More information about the cfe-dev mailing list