On Mon, Nov 12, 2012 at 4:08 PM, Nick Lewycky <[email protected]> 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 . -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
