[cfe-commits] r60897 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/ASTContext.cpp lib/AST/DeclBase.cpp lib/Analysis/RegionStore.cpp lib/CodeGen/CodeGenTypes.cpp lib/Sema/SemaCXXScopeSpec.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaOverload.cpp

Chris Lattner clattner at apple.com
Thu Dec 11 14:30:18 PST 2008


On Dec 11, 2008, at 2:22 PM, Douglas Gregor wrote:
>>> +  if (LookupCtx == 0 &&
>>> +      (!getLangOptions().CPlusPlus || (NS == Decl::IDNS_Label))) {
>>> +    // Unqualified name lookup in C/Objective-C and name lookup for
>>> +    // labels in C++ is purely lexical, so search in the
>>> +    // declarations attached to the name.
>>
>> Thanks for doing this.  One question that I thought I'd raise: name  
>> lookup for labels is sufficiently different (and extremely simple)  
>> that it might make sense to have a LookupLabelDecl() that is  
>> separate from LookupDecl().  I think labels can *never* be used  
>> with qualified names, can never be autosynth'd from builtins, etc.   
>> Also, the call sites for LookupDecl all know whether they want a  
>> label or not.
>>
>> Do you think it would make sense to split labels out from other  
>> decls for lookup?
>
> Hah! It turns out that we never actually use IDNS_Label in Clang :).  
> Labels go into the LabelMap (indexed by identifier), and never hit  
> the IdResolver.

Haha, okaaaay! :)  One issue is the GNU __label__ extension.  However,  
I have no great need or desire to support this in the short term :)

-Chris



More information about the cfe-commits mailing list