Home | History | Annotate | Download | only in Sema

Lines Matching refs:Previous

1446 /// extension, in C when the previous function is already an
1449 static bool AllowOverloadingOfFunction(LookupResult &Previous,
1455 if (Previous.getResultKind() == LookupResult::FoundOverloaded)
1458 return Previous.getResultKind() == LookupResult::Found &&
1459 (Previous.getFoundDecl()->hasAttr<OverloadableAttr>() ||
2157 LookupResult &Previous) {
2163 if (Previous.empty())
2166 LookupResult::Filter Filter = Previous.makeFilter();
2229 /// same name and scope as a previous declaration 'Old'. Figure out
2556 previous declaration to the
2561 // previous decl", for example if the attribute needs to be consistent
3064 // Determine whether the previous declaration was a definition, implicit
3215 /// declarator D which has the same name and scope as a previous
3322 // chain, emitting a "previous redecl" note is pointless.
3366 // Inherit the CC from the previous declaration if it was specified
3652 // As a special case, retain the language linkage from previous
3796 // If the previous declaration was an implicitly-generated builtin
3902 /// scope as a previous declaration 'Old'. Figure out how to merge their types,
3996 LookupResult &Previous) {
4005 if (Previous.isShadowed())
4025 /// and scope as a previous declaration 'Old'. Figure out how to resolve this
4032 void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
4037 if (!shouldLinkPossiblyHiddenDecl(Previous, New))
4045 if (Previous.isSingleResult()) {
4047 OldTemplate = dyn_cast<VarTemplateDecl>(Previous.getFoundDecl());
4051 dyn_cast<UsingShadowDecl>(Previous.getRepresentativeDecl()))
4055 Old = dyn_cast<VarDecl>(Previous.getFoundDecl());
4058 dyn_cast<UsingShadowDecl>(Previous.getRepresentativeDecl()))
4066 notePreviousDefinition(Previous.getRepresentativeDecl(),
4117 mergeTypeWithPrevious(*this, New, MostRecent, Previous));
4122 MergeVarDeclTypes(New, Old, mergeTypeWithPrevious(*this, New, Old, Previous));
4255 // Keep a chain of previous declarations.
4333 // The previous definition is hidden, and multiple definitions are
4758 // previous declaration.
5795 LookupResult Previous(*this, NameInfo, LookupOrdinaryName,
5823 Previous.clear(LookupRedeclarationWithLinkage);
5824 Previous.setRedeclarationKind(ForExternalRedeclaration);
5827 LookupName(Previous, S, CreateBuiltins);
5829 LookupQualifiedName(Previous, DC);
5839 // enough information to make sure that Previous contains the declaration
5849 // In this case, Previous will point to the overload set
5857 RemoveUsingDecls(Previous);
5860 if (Previous.isSingleResult() &&
5861 Previous.getFoundDecl()->isTemplateParameter()) {
5865 Previous.getFoundDecl());
5867 // Just pretend that we didn't see the previous declaration.
5868 Previous.clear();
5872 // Forget that the previous declaration is the injected-class-name.
5873 Previous.clear();
5875 // In C++, the previous declaration we find might be a tag type
5879 if (Previous.isSingleTagDecl() &&
5882 Previous.clear();
5898 New = ActOnTypedefDeclarator(S, D, DC, TInfo, Previous);
5900 New = ActOnFunctionDeclarator(S, D, DC, TInfo, Previous,
5904 New = ActOnVariableDeclarator(S, D, DC, TInfo, Previous, TemplateParamLists,
6122 TypeSourceInfo *TInfo, LookupResult &Previous) {
6130 Previous.clear();
6162 NamedDecl *ND = ActOnTypedefNameDecl(S, DC, NewTD, Previous, Redeclaration);
6209 LookupResult &Previous, bool &Redeclaration) {
6212 NamedDecl *ShadowedDecl = getShadowedDeclaration(NewTD, Previous);
6216 FilterLookupForScope(Previous, DC, S, /*ConsiderLinkage*/false,
6218 filterNonConflictingPreviousTypedefDecls(*this, NewTD, Previous);
6219 if (!Previous.empty()) {
6221 MergeTypedefNameDecl(S, NewTD, Previous);
6227 CheckShadow(NewTD, ShadowedDecl, Previous);
6247 /// previous declaration.
6250 /// previous declaration (PrevDecl) that is not in the scope where a
6252 /// declaration occurs in a local scope, previous declarations with
6253 /// linkage may still be considered previous declarations (C99
6256 /// \param PrevDecl the previous declaration found by name
6262 /// \returns true if PrevDecl is an out-of-scope previous declaration
6279 // linkage of the previous declaration.
6291 // previous declarations.
6295 // The previous declaration is in a different namespace, so it
6849 LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists,
7379 ? getShadowedDeclaration(NewVD, Previous)
7385 FilterLookupForScope(Previous, OriginalDC, S, shouldConsiderLinkage(NewVD),
7390 // Check whether the previous declaration is in the same block scope. This
7395 Previous.isSingleResult() && !Previous.isShadowed() &&
7396 isDeclInScope(Previous.getFoundDecl(), OriginalDC, S, false));
7399 D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
7403 CheckMemberSpecialization(NewVD, Previous))
7407 if (!Previous.empty()) {
7408 if (Previous.isSingleResult() &&
7409 isa<FieldDecl>(Previous.getFoundDecl()) &&
7415 Previous.clear();
7419 // No previous declaration in the qualifying scope.
7427 D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
7436 // merging in the template parameter list from the previous variable
7458 CheckShadow(NewVD, ShadowedDecl, Previous);
7497 if (D.isRedeclaration() && !Previous.empty()) {
7498 NamedDecl *Prev = Previous.getRepresentativeDecl();
7511 CompleteMemberSpecialization(NewVD, Previous);
7737 /// Check -Wshadow without the advantage of a previous lookup.
7774 /// previous global or extern "C" declarations. This is only used in C++.
7777 Sema &S, const T *ND, bool IsGlobal, LookupResult &Previous) {
7791 Previous.clear();
7792 Previous.addDecl(Prev);
7796 // This is a global, non-extern "C" declaration, and there is a previous
7807 for (LookupResult::iterator I = Previous.begin(), E = Previous.end();
7837 assert(Prev && "should have found a previous declaration to diagnose");
7860 LookupResult &Previous) {
7867 Previous.clear();
7868 Previous.addDecl(Prev);
7878 return checkGlobalOrExternCConflict(S, ND, /*IsGlobal*/true, Previous);
7884 return checkGlobalOrExternCConflict(S, ND, /*IsGlobal*/false, Previous);
8152 bool Sema::CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous) {
8161 if (Previous.empty() &&
8162 checkForConflictWithNonVisibleExternC(*this, NewVD, Previous))
8163 Previous.setShadowed();
8165 if (!Previous.empty()) {
8166 MergeVarDecl(NewVD, Previous);
8289 /// or performing typo correction if there are no previous declarations with
8295 Sema &SemaRef, LookupResult &Previous, FunctionDecl *NewFD,
8318 "Cannot have an ambiguity in previous-declaration lookup");
8343 Previous.clear();
8344 Previous.setLookupName(Correction.getCorrection());
8351 Previous.addDecl(FD);
8357 // Retry building the function declaration with the new previous
8369 NewFD->getTypeSourceInfo(), Previous, ExtraArgs.TemplateParamLists,
8379 for (LookupResult::iterator I = Previous.begin(), E = Previous.end();
8399 Previous.clear();
8400 Previous.setLookupName(Name);
8946 TypeSourceInfo *TInfo, LookupResult &Previous,
9332 // Filter out previous declarations that don't match the scope.
9333 FilterLookupForScope(Previous, OriginalDC, S, shouldConsiderLinkage(NewFD),
9510 D.setRedeclaration(CheckFunctionDeclaration(S, NewFD, Previous,
9512 else if (!Previous.empty())
9516 Previous.getResultKind() != LookupResult::FoundOverloaded) &&
9517 "previous declaration set still overloaded");
9602 maybeAddCUDAHostDeviceAttrs(NewFD, Previous);
9615 Previous))
9624 Previous))
9647 if (CheckMemberSpecialization(NewFD, Previous))
9660 D.setRedeclaration(CheckFunctionDeclaration(S, NewFD, Previous,
9662 else if (!Previous.empty())
9668 Previous.getResultKind() != LookupResult::FoundOverloaded) &&
9669 "previous declaration set still overloaded");
9716 // Qualified decls generally require a previous declaration.
9733 (!Previous.empty() && CurContext->isDependentContext()))) {
9756 *this, Previous, NewFD, ExtraArgs, false, nullptr)) {
9766 *this, Previous, NewFD, ExtraArgs, true, S)) {
9791 if (IdentifierInfo *II = Previous.getLookupName().getAsIdentifierInfo()) {
9862 if (D.isRedeclaration() && !Previous.empty()) {
9863 NamedDecl *Prev = Previous.getRepresentativeDecl();
9938 CompleteMemberSpecialization(NewFD, Previous);
10093 // Similarly, if the previous declaration was a dependent local extern
10105 /// \param PrevDecl Previous declaration found with proper lookup method for the
10422 LookupResult &Previous) {
10496 Previous.clear();
10507 LookupResult &Previous) {
10531 // previous member of the MultiVersion set.
10532 for (NamedDecl *ND : Previous) {
10643 Previous.clear();
10657 LookupResult &Previous) {
10688 // If there's no previous declaration, AND this isn't attempting to cause
10711 MergeTypeWithPrevious, Previous);
10715 previous declarations.
10718 OldDecl, MergeTypeWithPrevious, Previous);
10733 /// previous declaration).
10739 LookupResult &Previous,
10745 // a previous visible declaration. This never happens for functions in C++,
10746 // and always happens in C if the previous declaration was visible.
10748 !Previous.isShadowed();
10756 if (!Previous.empty()) {
10761 if (!AllowOverloadingOfFunction(Previous, Context, NewFD)) {
10762 NamedDecl *Candidate = Previous.getRepresentativeDecl();
10769 switch (CheckOverload(S, NewFD, Previous, OldDecl,
10786 // Check for a previous extern "C" declaration with this name.
10788 checkForConflictWithNonVisibleExternC(*this, NewFD, Previous)) {
10789 if (!Previous.empty()) {
10790 // This is an extern "C" declaration with the same name as a previous
10793 OldDecl = Previous.getFoundDecl();
10809 MergeTypeWithPrevious, Previous))
10864 Previous.clear();
10865 Previous.addDecl(OldDecl);
10912 assert((Previous.empty() ||
10913 llvm::any_of(Previous,
10919 auto OtherUnmarkedIter = llvm::find_if(Previous, [](const NamedDecl *ND) {
10924 if (OtherUnmarkedIter != Previous.end()) {
11016 if (Previous.empty() && NewFD->isExternC()) {
11063 checkCUDATargetOverload(NewFD, Previous);
13006 // Find a previous declaration that's not a definition.
13708 // Just pretend that we didn't see the previous declaration.
14067 SkipBody->Previous = const_cast<FunctionDecl*>(Definition);
14511 // Warn if a global function is defined without a previous
14579 // Warn if K&R function is defined without a previous declaration.
15201 /// Check whether this is a valid redeclaration of a previous enumeration.
15287 bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous,
15304 TagTypeKind OldTag = Previous->getTagKind();
15329 while (IsIgnored(Previous)) {
15330 Previous = Previous->getPreviousDecl();
15331 if (!Previous)
15333 OldTag = Previous->getTagKind();
15337 if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Previous))
15347 // FIXME: Note previous location?
15353 // On definitions, check all previous tags and issue a fix-it for each
15355 if (Previous->getDefinition()) {
15361 for (const TagDecl *I : Previous->redecls()) {
15363 // Ignore previous declarations for which the warning was disabled.
15385 const TagDecl *PrevDef = Previous->getDefinition();
15388 const TagDecl *Redecl = PrevDef ? PrevDef : Previous;
15395 // If there is a previous definition, suggest a fix-it.
15451 /// found a declaration in \p OldDC as a previous decl, perhaps through a
15640 LookupResult Previous(*this, Name, NameLoc, LookupTagName, Redecl);
15672 LookupQualifiedName(Previous, DC);
15674 if (Previous.isAmbiguous())
15677 if (Previous.empty()) {
15684 if (Previous.wasNotFoundInCurrentInstantiation() &&
15706 // If this is a named struct, check to see if there was a previous forward
15711 LookupName(Previous, S);
15715 if (Previous.isAmbiguous() &&
15717 LookupResult::Filter F = Previous.makeFilter();
15740 if (!Previous.empty() && TUK == TUK_Friend) {
15742 LookupResult::Filter F = Previous.makeFilter();
15759 if (Previous.isSingleResult() && FriendSawTagOutsideEnclosingNamespace) {
15760 NamedDecl *ND = Previous.getFoundDecl();
15767 if (Previous.isAmbiguous())
15780 if (Previous.isSingleResult() &&
15781 Previous.getFoundDecl()->isTemplateParameter()) {
15783 DiagnoseTemplateParameterShadow(NameLoc, Previous.getFoundDecl());
15784 // Just pretend that we didn't see the previous declaration.
15785 Previous.clear();
15795 // name lookup), fill in this implicit declaration as the previous
15797 if (Previous.empty() && StdBadAlloc)
15798 Previous.addDecl(getStdBadAlloc());
15801 if (Previous.empty() && StdAlignValT)
15802 Previous.addDecl(getStdAlignValT());
15806 // If we didn't find a previous declaration, and this is a reference
15810 if (Name && Previous.empty() &&
15866 Previous.setRedeclarationKind(forRedeclarationInCurContext());
15867 LookupQualifiedName(Previous, SearchDC);
15869 Previous.setRedeclarationKind(forRedeclarationInCurContext());
15870 LookupName(Previous, S);
15874 // If we have a known previous declaration to use, then use it.
15875 if (Previous.empty() && SkipBody && SkipBody->Previous)
15876 Previous.addDecl(SkipBody->Previous);
15878 if (!Previous.empty()) {
15879 NamedDecl *PrevDecl = Previous.getFoundDecl();
15880 NamedDecl *DirectPrevDecl = Previous.getRepresentativeDecl();
15899 Previous.clear();
15900 Previous.addDecl(Tag);
15901 Previous.resolveKind();
15922 Previous.clear();
15928 // If this is a use of a previous tag, or if the tag is already declared
15956 Previous.clear();
15972 // All conflicts with previous declarations are recovered by
15973 // returning the previous declaration, unless this is a definition,
16024 // If we're defining a specialization and the previous definition
16056 SkipBody->Previous = Def;
16060 SkipBody->Previous = Def;
16076 // references get the previous definition.
16078 Previous.clear();
16090 Previous.clear();
16115 Previous.clear();
16129 !Previous.isForRedeclaration()) {
16169 // new scope, so clear out the previous declaration.
16170 Previous.clear();
16177 if (Previous.isSingleResult())
16178 PrevDecl = cast<TagDecl>(Previous.getFoundDecl());
16185 // Otherwise, create a new declaration. If there is a previous
16312 if (isMemberSpecialization && CheckMemberSpecialization(New, Previous))
16397 CompleteMemberSpecialization(New, Previous);
16408 return SkipBody->Previous;
16433 // Make the previous decl visible.
16434 makeMergedDefinitionVisible(SkipBody.Previous);
16701 LookupResult Previous(*this, II, Loc, LookupMemberName,
16703 LookupName(Previous, S);
16704 switch (Previous.getResultKind()) {
16707 PrevDecl = Previous.getAsSingle<NamedDecl>();
16711 PrevDecl = Previous.getRepresentativeDecl();
16719 Previous.suppressDiagnostics();
16724 // Just pretend that we didn't see the previous declaration.
16758 /// record, etc. \p PrevDecl should refer to any previous declaration
17871 Skip.Previous = Hidden;
17899 // Just pretend that we didn't see the previous declaration.
17991 // a previous element has already been set to.
18027 // Null EnumConstantDecl means a previous diagnostic has been emitted for