Lines Matching refs:Name
1 //===--------------------- SemaLookup.cpp - Name Lookup ------------------===//
10 // This file implements name lookup for C, C++, Objective-C, and
107 // During unqualified name lookup, the names appear as if they
211 // specific kind of name lookup.
233 // as (e.g.) looking up an operator name for redeclaration.
242 // When looking for a redeclaration of a tag name, we add:
375 // However, per C++ [dcl.typedef]p5, when looking up a tag name, prefer a tag
445 // exactly one declaration shall declare a class name or enumeration name
446 // that is not a typedef name
448 // templates; in this case the class name or enumeration name is hidden.
450 // A class name or enumeration name can be hidden by the name of a
577 // A class name or enumeration name can be hidden by the name of
579 // scope. If a class or enumeration name and an object, function,
581 // with the same name, the class or enumeration name is hidden
582 // wherever the object, function, or enumerator name is visible.
653 /// \brief Lookup a builtin function, when name lookup would otherwise
742 /// \brief Determine whether this is the name of an implicitly-declared
744 static bool isImplicitlyDeclaredMemberFunctionName(DeclarationName Name) {
745 switch (Name.getNameKind()) {
751 return Name.getCXXOverloadedOperator() == OO_Equal;
760 /// \brief If there are any implicit member functions with the given name
763 DeclarationName Name,
768 switch (Name.getNameKind()) {
791 if (Name.getCXXOverloadedOperator() != OO_Equal)
811 // Adds all qualifying matches for a name within a decl context to the
842 // name lookup. Instead, any conversion function templates visible in the
867 // name lookup.
882 // function to have, if it were to match the name given.
911 // Perform direct name lookup into the LookupCtx.
914 // Perform direct name lookup into the namespaces nominated by the
936 // name lookup should continue searching in this semantic context when
952 // definition, the name of a template-parameter hides the name of
1023 DeclarationName Name = R.getLookupName();
1026 // If this is the name of an implicitly-declared special member function,
1028 if (isImplicitlyDeclaredMemberFunctionName(Name)) {
1031 DeclareImplicitMemberFunctionsWithName(*this, Name, DC);
1034 // Implicitly declare member functions with the name we're looking for, if in
1039 I = IdResolver.begin(Name),
1044 // ...During unqualified name lookup (3.4.1), the names appear as if
1105 // If a friend declaration appears in a local class and the name
1106 // specified is an unqualified name, a prior declaration is
1117 // findOuterContext(). This implements the name lookup behavior
1144 if (Method->isInstanceMethod() && Name.getAsIdentifierInfo())
1148 Name.getAsIdentifierInfo(),
1162 // If this is a file context, we need to perform unqualified name
1196 // Perform qualified name lookup into this context.
1197 // FIXME: In some cases, we know that every name that could be found by
1198 // this qualified name lookup will also be on the identifier chain. For
1232 // Unqualified name lookup in C++ requires looking into scopes
1241 // with this same name and in an acceptable identifier
1260 // findOuterContext(). This implements the name lookup behavior
1466 /// \brief Determine whether a declaration is visible to name lookup.
1582 /// @brief Perform unqualified name lookup starting from a given
1585 /// Unqualified name lookup (C++ [basic.lookup.unqual], C99 6.2.1) is
1590 /// return x; // unqualified name look finds 'x' in the global scope
1596 /// name, and each can be found by certain lookup criteria. For more
1600 /// @param S The scope from which unqualified name lookup will
1601 /// begin. If the lookup criteria permits, name lookup may also search
1604 /// @param [in,out] R Specifies the lookup to perform (e.g., the name to
1611 DeclarationName Name = R.getLookupName();
1612 if (!Name) return false;
1617 // Unqualified name lookup in C/Objective-C is purely lexical, so
1618 // search in the declarations attached to the name.
1635 for (IdentifierResolver::iterator I = IdResolver.begin(Name),
1658 // Check whether there are any other declarations with the same name
1702 // Perform C++ unqualified name lookup.
1720 /// @brief Perform qualified name lookup in the namespaces nominated by
1731 /// the lookup of a name. If S is the empty set, the program is
1739 /// During the lookup of a qualified namespace member name, if the
1741 /// declaration introduces a class name or enumeration name and the
1743 /// enumerator or a set of functions, the non-type name hides the
1744 /// class or enumeration name if and only if the declarations are
1829 /// \brief Callback that looks for any member of a class with the given name.
1831 CXXBasePath &Path, DeclarationName Name) {
1834 Path.Decls = BaseRecord->lookup(Name);
1870 /// \brief Perform qualified name lookup into a given context.
1872 /// Qualified name lookup (C++ [basic.lookup.qual]) is used to find
1874 /// "std::vector" or "x->member", or as part of unqualified name lookup.
1878 /// name, and each can be found by certain lookup criteria. For more
1884 /// \param LookupCtx The context in which qualified name lookup will
1885 /// search. If the lookup criteria permits, name lookup may also search
1888 /// \param InUnqualifiedLookup true if this is qualified name lookup that
1889 /// occurs as part of unqualified name lookup.
1909 // Set flag in DeclContext informing debugger that we're looking for qualified name
1930 // nested-name-specifier unqualified-id
1931 // the unqualified-id shall name a member of the namespace
1932 // designated by the nested-name-specifier.
1947 // If we're performing qualified name lookup into a dependent class,
1964 DeclarationName Name) = nullptr;
1997 DeclarationName Name = R.getLookupName();
2000 return BaseCallback(Specifier, Path, Name);
2035 // We found members of the given name in two subobjects of
2072 // We have found a nonstatic member name in multiple, distinct
2073 // subobjects. Name lookup is ambiguous.
2090 /// \brief Performs qualified name lookup or special type of lookup for
2094 /// that need to perform a qualified name lookup with an optional C++ scope
2099 /// \param LookupCtx The context in which qualified name lookup will
2115 /// @brief Performs name lookup for a name that was parsed in the
2119 /// contexts that receive a name and an optional C++ scope specifier
2121 /// unqualified name lookup (with LookupQualifiedName or LookupName,
2122 /// respectively) on the given name and return those results. It will
2125 /// @param S The scope from which unqualified name lookup will
2149 // contex, and will perform name lookup in that context.
2159 // Name lookup can't find anything in this case.
2165 // Perform unqualified name lookup starting in the given scope.
2169 /// \brief Perform qualified name lookup into all base classes of the given
2174 /// \param Class The context in which qualified name lookup will
2175 /// search. Name lookup will search in all base classes merging the results.
2208 /// from name lookup.
2214 DeclarationName Name = Result.getLookupName();
2223 << Name << SubobjectType << getAmbiguousPathsDisplayString(*Paths)
2237 << Name << LookupRange;
2252 Diag(NameLoc, diag::err_ambiguous_tag_hiding) << Name << LookupRange;
2277 Diag(NameLoc, diag::err_ambiguous_reference) << Name << LookupRange;
2380 // Just silently ignore anything whose name is __va_list_tag.
2659 // [...] In addition, if the argument is the name or address of a
2685 NamedDecl *Sema::LookupSingleName(Scope *S, DeclarationName Name,
2689 LookupResult R(*this, Name, Loc, NameKind, Redecl);
2694 /// \brief Find the protocol with the given name, if any.
2709 // expression according to the usual rules for name lookup in
2773 DeclarationName Name;
2781 Name = Context.DeclarationNames.getCXXConstructorName(CanTy);
2787 Name = Context.DeclarationNames.getCXXConstructorName(CanTy);
2793 Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal);
2835 // Now we perform lookup on the name we computed earlier and do overload
2839 DeclContext::lookup_result R = RD->lookup(Name);
2966 DeclarationName Name = Context.DeclarationNames.getCXXConstructorName(T);
2967 return Class->lookup(Name);
3019 /// call for a user-defined literal. Look up the provided literal operator name,
3164 void Sema::ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc,
3180 // below. The set of declarations found by the lookup of the name
3197 DeclContext::lookup_result R = NS->lookup(Name);
3254 /// this name within a particular scope.
3257 /// \brief A list of shadow maps, which is used to model name hiding.
3369 for (StringRef Name = Iter->Next(); !Name.empty(); Name = Iter->Next())
3370 Idents.get(Name);
3403 // Traverse using directives for qualified name lookup.
3420 // Don't look into dependent bases, because name lookup can't look
3551 // We've already performed all of the name lookup that we need
3569 // doing so would force the normal C++ name-lookup code to look into the
3596 // unqualified name lookup.
3631 /// LookupOrCreateLabel - Do a name lookup of a label with the specified name.
3633 /// of an __label__ label name, otherwise it is a normal label definition
3637 // Do a lookup to see if we have a label with this name already.
3676 IdentifierInfo *Name,
3777 IdentifierInfo *Name = ND->getIdentifier();
3778 if (!Name)
3783 if (!LookupResult::isVisible(SemaRef, ND) && Name != Typo &&
3787 FoundName(Name->getName());
3790 void TypoCorrectionConsumer::FoundName(StringRef Name) {
3791 // Compute the edit distance between the typo and the name of this
3793 addName(Name, nullptr);
3802 void TypoCorrectionConsumer::addName(StringRef Name, NamedDecl *ND,
3807 unsigned MinED = abs((int)Name.size() - (int)TypoStr.size());
3814 unsigned ED = TypoStr.edit_distance(Name, true, UpperBound);
3817 TypoCorrection TC(&SemaRef.Context.Idents.get(Name), ND, NNS, ED);
3827 StringRef Name = Correction.getCorrectionAsIdentifierInfo()->getName();
3833 (Name != TypoStr || Correction.getEditDistance(true) > TypoStr.size()))
3844 CorrectionResults[Correction.getEditDistance(false)][Name];
3929 IdentifierInfo *Name = Candidate.getCorrectionAsIdentifierInfo();
3933 Name, S, TempSS, TempMemberContext,
3936 Name == Typo && !Candidate.WillReplaceSpecifier());
3986 // current correction candidate is the name of that class, then skip
4003 // distance, then skip performing a qualified name lookup.
4141 IdentifierInfo *Name = ND->getIdentifier();
4145 Name) != CurNameSpecifierIdentifiers.end()) {
4156 Name) != CurContextIdentifiers.end()) {
4180 /// \brief Perform name lookup for a possible result for typo correction.
4183 IdentifierInfo *Name,
4191 Res.setLookupName(Name);
4196 if (ObjCIvarDecl *Ivar = Class->lookupInstanceVariable(Name)) {
4203 if (ObjCPropertyDecl *Prop = Class->FindPropertyDeclaration(Name)) {
4225 = Method->getClassInterface()->lookupInstanceVariable(Name)) {
4455 // Perform name lookup to find visible, similarly-named entities.
4495 StringRef Name = Iter->Next();
4496 if (Name.empty())
4499 Consumer->FoundName(Name);
4525 /// visible declarations whose names are similar to the name that was
4529 /// the name that was present in the source code along with its location.
4531 /// \param LookupKind the name-lookup criteria used to search for the name.
4533 /// \param S the scope in which name lookup occurs.
4535 /// \param SS the nested-name-specifier that precedes the name we're
4546 /// the nested-name-specifier SS.
4551 /// \returns a \c TypoCorrection containing the corrected name if the typo
4552 /// along with information such as the \c NamedDecl where the corrected name
4613 // If only a single name remains, return that result.
4654 /// visible declarations whose names are similar to the name that was
4658 /// the name that was present in the source code along with its location.
4660 /// \param LookupKind the name-lookup criteria used to search for the name.
4662 /// \param S the scope in which name lookup occurs.
4664 /// \param SS the nested-name-specifier that precedes the name we're
4681 /// the nested-name-specifier SS.