Lines Matching refs:Previous
813 /// extension, in C when the previous function is already an
816 static bool AllowOverloadingOfFunction(LookupResult &Previous,
821 if (Previous.getResultKind() == LookupResult::FoundOverloaded)
824 return (Previous.getResultKind() == LookupResult::Found
825 && Previous.getFoundDecl()->hasAttr<OverloadableAttr>());
1293 /// same name and scope as a previous declaration 'Old'. Figure out
1555 /// declarator D which has the same name and scope as a previous
1589 // Determine whether the previous declaration was a definition,
1965 /// scope as a previous declaration 'Old'. Figure out how to merge their types,
2025 /// and scope as a previous declaration 'Old'. Figure out how to resolve this
2032 void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
2039 if (!Previous.isSingleResult() ||
2040 !(Old = dyn_cast<VarDecl>(Previous.getFoundDecl()))) {
2043 Diag(Previous.getRepresentativeDecl()->getLocation(),
2158 // Keep a chain of previous declarations.
3084 LookupResult Previous(*this, NameInfo, LookupOrdinaryName,
3107 Previous.clear(LookupRedeclarationWithLinkage);
3109 LookupName(Previous, S, /* CreateBuiltins = */ IsLinkageLookup);
3111 LookupQualifiedName(Previous, DC);
3113 // Don't consider using declarations as previous declarations for
3115 RemoveUsingDecls(Previous);
3163 if (Previous.isSingleResult() &&
3164 Previous.getFoundDecl()->isTemplateParameter()) {
3168 Previous.getFoundDecl()))
3171 // Just pretend that we didn't see the previous declaration.
3172 Previous.clear();
3175 // In C++, the previous declaration we find might be a tag type
3179 if (Previous.isSingleTagDecl() &&
3181 Previous.clear();
3190 New = ActOnTypedefDeclarator(S, D, DC, R, TInfo, Previous, Redeclaration);
3192 New = ActOnFunctionDeclarator(S, D, DC, R, TInfo, Previous,
3196 New = ActOnVariableDeclarator(S, D, DC, R, TInfo, Previous,
3288 const LookupResult &Previous,
3295 if (!Previous.isSingleResult())
3298 NamedDecl *PrevDecl = Previous.getFoundDecl();
3300 // If there was a previous declaration of this variable, it may be
3304 // The previous declaration was found on the identifer resolver
3345 LookupResult &Previous, bool &Redeclaration) {
3353 Previous.clear();
3380 return ActOnTypedefNameDecl(S, DC, NewTD, Previous, Redeclaration);
3423 LookupResult &Previous, bool &Redeclaration) {
3426 FilterLookupForScope(Previous, DC, S, /*ConsiderLinkage*/ false,
3428 if (!Previous.empty()) {
3430 MergeTypedefNameDecl(NewTD, Previous);
3451 /// previous declaration.
3454 /// previous declaration (PrevDecl) that is not in the scope where a
3456 /// declaration occurs in a local scope, previous declarations with
3457 /// linkage may still be considered previous declarations (C99
3460 /// \param PrevDecl the previous declaration found by name
3466 /// \returns true if PrevDecl is an out-of-scope previous declaration
3483 // linkage of the previous declaration.
3495 // previous declarations.
3499 // The previous declaration is in a different namespace, so it
3561 LookupResult &Previous,
3749 CheckShadow(S, NewVD, Previous);
3754 FilterLookupForScope(Previous, DC, S, NewVD->hasLinkage(),
3758 CheckVariableDeclaration(NewVD, Previous, Redeclaration);
3761 if (!Previous.empty()) {
3762 if (Previous.isSingleResult() &&
3763 isa<FieldDecl>(Previous.getFoundDecl()) &&
3769 Previous.clear();
3773 // No previous declaration in the qualifying scope.
3780 CheckVariableDeclaration(NewVD, Previous, Redeclaration);
3784 CheckMemberSpecialization(NewVD, Previous))
3791 if (Previous.isSingleResult()) {
3792 VarDecl *Def = dyn_cast<VarDecl>(Previous
3804 RegisterLocallyScopedExternCDecl(NewVD, Previous, S);
3899 /// \brief Check -Wshadow without the advantage of a previous lookup.
3922 LookupResult &Previous,
3995 if (Previous.empty() && NewVD->isExternC()) {
4002 Previous.addDecl(Pos->second);
4038 if (!Previous.empty()) {
4040 MergeVarDecl(NewVD, Previous);
4116 "Cannot have an ambiguity in previous-declaration lookup");
4128 LookupResult &Previous,
4204 // Filter out previous declarations that don't match the scope.
4205 FilterLookupForScope(Previous, DC, S, NewFD->hasLinkage(),
4498 // Filter out previous declarations that don't match the scope.
4499 FilterLookupForScope(Previous, DC, S, NewFD->hasLinkage(),
4504 // For now, claim that the objects have no previous declaration.
4616 CheckFunctionDeclaration(S, NewFD, Previous, isExplicitSpecialization,
4619 Previous.getResultKind() != LookupResult::FoundOverloaded) &&
4620 "previous declaration set still overloaded");
4684 Previous))
4695 Previous))
4717 if (CheckMemberSpecialization(NewFD, Previous))
4722 CheckFunctionDeclaration(S, NewFD, Previous, isExplicitSpecialization,
4726 Previous.getResultKind() != LookupResult::FoundOverloaded) &&
4727 "previous declaration set still overloaded");
4772 // Qualified decls generally require a previous declaration.
4842 if (Redeclaration && Previous.isSingleResult()) {
4844 FunctionDecl *PrevFD = dyn_cast<FunctionDecl>(Previous.getFoundDecl());
4878 RegisterLocallyScopedExternCDecl(NewFD, Previous, S);
4919 /// an explicit specialization of the previous declaration.
4923 LookupResult &Previous,
4946 // Check for a previous declaration of this name.
4947 if (Previous.empty() && NewFD->isExternC()) {
4954 Previous.addDecl(Pos->second);
4959 if (!Previous.empty()) {
4966 if (!AllowOverloadingOfFunction(Previous, Context)) {
4968 OldDecl = Previous.getFoundDecl();
4970 switch (CheckOverload(S, NewFD, Previous, OldDecl,
4993 else if (!Previous.empty())
4994 OverloadedDecl = Previous.getRepresentativeDecl();
5009 Previous.clear();
5010 Previous.addDecl(OldDecl);
6039 // Just pretend that we didn't see the previous declaration.
6295 // Don't complain if we're in GNU89 mode and the previous definition
6348 // Warn if a global function is defined without a previous
6757 bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous,
6774 TagTypeKind OldTag = Previous->getTagKind();
6783 if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Previous))
6795 // On definitions, check previous tags and issue a fix-it for each
6797 if (Previous->getDefinition()) {
6803 for (TagDecl::redecl_iterator I(Previous->redecls_begin()),
6804 E(Previous->redecls_end()); I != E; ++I) {
6821 // Check for a previous definition. If current tag and definition
6823 // with previous tag type, give a warning, but no fix-it.
6824 const TagDecl *Redecl = Previous->getDefinition() ?
6825 Previous->getDefinition() : Previous;
6835 // If there is a previous defintion, suggest a fix-it.
6836 if (Previous->getDefinition()) {
6950 LookupResult Previous(*this, Name, NameLoc, LookupTagName, Redecl);
6983 LookupQualifiedName(Previous, DC);
6985 if (Previous.isAmbiguous())
6988 if (Previous.empty()) {
6995 if (Previous.wasNotFoundInCurrentInstantiation() &&
7009 // If this is a named struct, check to see if there was a previous forward
7014 LookupName(Previous, S);
7016 if (Previous.isAmbiguous() &&
7018 LookupResult::Filter F = Previous.makeFilter();
7028 if (Previous.isAmbiguous())
7045 if (Previous.isSingleResult() &&
7046 Previous.getFoundDecl()->isTemplateParameter()) {
7048 DiagnoseTemplateParameterShadow(NameLoc, Previous.getFoundDecl());
7049 // Just pretend that we didn't see the previous declaration.
7050 Previous.clear();
7058 if (Previous.empty() && StdBadAlloc) {
7060 // name lookup). Fill in this implicit declaration as the previous
7062 Previous.addDecl(getStdBadAlloc());
7066 // If we didn't find a previous declaration, and this is a reference
7070 if (Name && Previous.empty() &&
7127 Previous.setRedeclarationKind(ForRedeclaration);
7128 LookupQualifiedName(Previous, SearchDC);
7132 if (!Previous.empty()) {
7133 NamedDecl *PrevDecl = (*Previous.begin())->getUnderlyingDecl();
7152 Previous.clear();
7153 Previous.addDecl(Tag);
7154 Previous.resolveKind();
7161 // If this is a use of a previous tag, or if the tag is already declared
7188 Previous.clear();
7196 // All conflicts with previous declarations are recovered by
7197 // returning the previous declaration.
7242 // If we're defining a specialization and the previous definition
7253 // references get the previous definition.
7255 Previous.clear();
7268 Previous.clear();
7285 Previous.clear();
7302 !Previous.isForRedeclaration()) {
7347 // new scope, so clear out the previous declaration.
7348 Previous.clear();
7355 if (Previous.isSingleResult())
7356 PrevDecl = cast<TagDecl>(Previous.getFoundDecl());
7363 // Otherwise, create a new declaration. If there is a previous
7459 if (isExplicitSpecialization && CheckMemberSpecialization(New, Previous))
7482 New->setObjectOfFriendDecl(/* PreviouslyDeclared = */ !Previous.empty() ||
7708 LookupResult Previous(*this, II, Loc, LookupMemberName, ForRedeclaration);
7709 LookupName(Previous, S);
7710 assert((Previous.empty() || Previous.isOverloadedResult() ||
7711 Previous.isSingleResult())
7715 NamedDecl *PrevDecl = Previous.isOverloadedResult() ?
7716 Previous.getRepresentativeDecl() : Previous.getAsSingle<NamedDecl>();
7721 // Just pretend that we didn't see the previous declaration.
7752 /// record, etc. \p PrevDecl should refer to any previous declaration
8826 // Just pretend that we didn't see the previous declaration.