[cfe-commits] r167786 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaTemplate/dependent-names.cpp

Richard Smith richard at metafoo.co.uk
Fri Dec 21 18:47:39 PST 2012


On Fri, Dec 21, 2012 at 6:08 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Mon, Nov 12, 2012 at 4:08 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
>> Author: nicholas
>> Date: Mon Nov 12 18:08:34 2012
>> New Revision: 167786
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=167786&view=rev
>> Log:
>> When filtering the list of associated namespaces so that we don't suggest people
>> add functions to namespace 'std', also filter out namespaces with '__' anywhere
>> in the name.
>>
>> Modified:
>>     cfe/trunk/lib/Sema/SemaOverload.cpp
>>     cfe/trunk/test/SemaTemplate/dependent-names.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=167786&r1=167785&r2=167786&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Nov 12 18:08:34 2012
>> @@ -9536,18 +9536,16 @@
>>        SemaRef.FindAssociatedClassesAndNamespaces(FnLoc, Args,
>>                                                   AssociatedNamespaces,
>>                                                   AssociatedClasses);
>> -      // Never suggest declaring a function within namespace 'std'.
>> +      // Never suggest declaring a function within namespace 'std'.
>>        Sema::AssociatedNamespaceSet SuggestedNamespaces;
>> -      if (DeclContext *Std = SemaRef.getStdNamespace()) {
>> -        for (Sema::AssociatedNamespaceSet::iterator
>> -               it = AssociatedNamespaces.begin(),
>> -               end = AssociatedNamespaces.end(); it != end; ++it) {
>> -          if (!Std->Encloses(*it))
>> -            SuggestedNamespaces.insert(*it);
>> -        }
>> -      } else {
>> -        // Lacking the 'std::' namespace, use all of the associated namespaces.
>> -        SuggestedNamespaces = AssociatedNamespaces;
>> +      DeclContext *Std = SemaRef.getStdNamespace();
>> +      for (Sema::AssociatedNamespaceSet::iterator
>> +             it = AssociatedNamespaces.begin(),
>> +             end = AssociatedNamespaces.end(); it != end; ++it) {
>> +        NamespaceDecl *Assoc = cast<NamespaceDecl>(*it);
>> +        if ((!Std || !Std->Encloses(Assoc)) &&
>> +            Assoc->getQualifiedNameAsString().find("__") == std::string::npos)
>> +          SuggestedNamespaces.insert(Assoc);
>>        }
>
> This appears to have caused http://llvm.org/bugs/show_bug.cgi?id=14695 .

Fixed in r170976.



More information about the cfe-commits mailing list