• Home
  • Raw
  • Download

Lines Matching refs:Old

1871     NamedDecl *Old = Filter.next();  in filterNonConflictingPreviousTypedefDecls()  local
1874 if (S.isVisible(Old)) in filterNonConflictingPreviousTypedefDecls()
1879 if (auto *OldTD = dyn_cast<TypedefNameDecl>(Old)) { in filterNonConflictingPreviousTypedefDecls()
1898 bool Sema::isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New) { in isIncompatibleTypedef() argument
1900 if (TypedefNameDecl *OldTypedef = dyn_cast<TypedefNameDecl>(Old)) in isIncompatibleTypedef()
1903 OldType = Context.getTypeDeclType(Old); in isIncompatibleTypedef()
1908 int Kind = isa<TypeAliasDecl>(Old) ? 1 : 0; in isIncompatibleTypedef()
1911 if (Old->getLocation().isValid()) in isIncompatibleTypedef()
1912 Diag(Old->getLocation(), diag::note_previous_definition); in isIncompatibleTypedef()
1921 int Kind = isa<TypeAliasDecl>(Old) ? 1 : 0; in isIncompatibleTypedef()
1924 if (Old->getLocation().isValid()) in isIncompatibleTypedef()
1925 Diag(Old->getLocation(), diag::note_previous_definition); in isIncompatibleTypedef()
1985 TypeDecl *Old = OldDecls.getAsSingle<TypeDecl>(); in MergeTypedefNameDecl() local
1986 if (!Old) { in MergeTypedefNameDecl()
1998 if (Old->isInvalidDecl()) in MergeTypedefNameDecl()
2001 if (auto *OldTD = dyn_cast<TypedefNameDecl>(Old)) { in MergeTypedefNameDecl()
2037 if (isIncompatibleTypedef(Old, New)) in MergeTypedefNameDecl()
2042 if (TypedefNameDecl *Typedef = dyn_cast<TypedefNameDecl>(Old)) { in MergeTypedefNameDecl()
2044 mergeDeclAttributes(New, Old); in MergeTypedefNameDecl()
2079 if (!isa<TypedefNameDecl>(Old)) in MergeTypedefNameDecl()
2084 Diag(Old->getLocation(), diag::note_previous_definition); in MergeTypedefNameDecl()
2097 (Context.getSourceManager().isInSystemHeader(Old->getLocation()) || in MergeTypedefNameDecl()
2103 Diag(Old->getLocation(), diag::note_previous_definition); in MergeTypedefNameDecl()
2139 static bool mergeAlignedAttrs(Sema &S, NamedDecl *New, Decl *Old) { in mergeAlignedAttrs() argument
2145 for (auto *I : Old->specific_attrs<AlignedAttr>()) { in mergeAlignedAttrs()
2344 static void checkNewAttributesAfterDef(Sema &S, Decl *New, const Decl *Old) { in checkNewAttributesAfterDef() argument
2348 const Decl *Def = getDefinition(Old); in checkNewAttributesAfterDef()
2427 void Sema::mergeDeclAttributes(NamedDecl *New, Decl *Old, in mergeDeclAttributes() argument
2429 if (UsedAttr *OldAttr = Old->getMostRecentDecl()->getAttr<UsedAttr>()) { in mergeDeclAttributes()
2435 if (!Old->hasAttrs() && !New->hasAttrs()) in mergeDeclAttributes()
2439 checkNewAttributesAfterDef(*this, New, Old); in mergeDeclAttributes()
2442 if (AsmLabelAttr *OldA = Old->getAttr<AsmLabelAttr>()) { in mergeDeclAttributes()
2448 } else if (Old->isUsed()) { in mergeDeclAttributes()
2452 << isa<FunctionDecl>(Old) << New->getAttr<AsmLabelAttr>()->getRange(); in mergeDeclAttributes()
2458 if (const auto *OldAbiTagAttr = Old->getAttr<AbiTagAttr>()) { in mergeDeclAttributes()
2470 Diag(Old->getLocation(), diag::note_previous_declaration); in mergeDeclAttributes()
2474 if (!Old->hasAttrs()) in mergeDeclAttributes()
2483 for (auto *I : Old->specific_attrs<InheritableAttr>()) { in mergeDeclAttributes()
2509 if (mergeAlignedAttrs(*this, New, Old)) in mergeDeclAttributes()
2625 getNoteDiagForInvalidRedeclaration(const T *Old, const T *New) { in getNoteDiagForInvalidRedeclaration() argument
2627 SourceLocation OldLocation = Old->getLocation(); in getNoteDiagForInvalidRedeclaration()
2628 if (Old->isThisDeclarationADefinition()) in getNoteDiagForInvalidRedeclaration()
2630 else if (Old->isImplicit()) { in getNoteDiagForInvalidRedeclaration()
2658 static bool haveIncompatibleLanguageLinkages(const T *Old, const T *New) { in haveIncompatibleLanguageLinkages() argument
2659 const DeclContext *DC = Old->getDeclContext(); in haveIncompatibleLanguageLinkages()
2663 LanguageLinkage OldLinkage = Old->getLanguageLinkage(); in haveIncompatibleLanguageLinkages()
2697 auto *Old = dyn_cast<ExpectedDecl>(OldS->getTargetDecl()); in checkUsingShadowRedecl() local
2698 if (Old && in checkUsingShadowRedecl()
2699 !Old->getDeclContext()->getRedeclContext()->Equals( in checkUsingShadowRedecl()
2701 !(isExternC(Old) && isExternC(New))) in checkUsingShadowRedecl()
2702 Old = nullptr; in checkUsingShadowRedecl()
2704 if (!Old) { in checkUsingShadowRedecl()
2742 FunctionDecl *Old = OldD->getAsFunction(); in MergeFunctionDecl() local
2743 if (!Old) { in MergeFunctionDecl()
2757 OldD = Old = cast<FunctionDecl>(Shadow->getTargetDecl()); in MergeFunctionDecl()
2767 if (Old->isInvalidDecl()) in MergeFunctionDecl()
2773 getNoteDiagForInvalidRedeclaration(Old, New); in MergeFunctionDecl()
2779 if (!isa<CXXMethodDecl>(New) && !isa<CXXMethodDecl>(Old) && in MergeFunctionDecl()
2781 Old->hasExternalFormalLinkage() && in MergeFunctionDecl()
2783 !canRedefineFunction(Old, getLangOpts())) { in MergeFunctionDecl()
2795 !Old->hasAttr<InternalLinkageAttr>()) { in MergeFunctionDecl()
2798 Diag(Old->getLocation(), diag::note_previous_definition); in MergeFunctionDecl()
2815 QualType OldQType = Context.getCanonicalType(Old->getType()); in MergeFunctionDecl()
2824 FunctionDecl *First = Old->getFirstDecl(); in MergeFunctionDecl()
2892 if (!Old->isInlined() && New->isInlined() && in MergeFunctionDecl()
2895 Old->isUsed(false) && in MergeFunctionDecl()
2896 !Old->isDefined() && !New->isThisDeclarationADefinition()) in MergeFunctionDecl()
2897 UndefinedButUsed.insert(std::make_pair(Old->getCanonicalDecl(), in MergeFunctionDecl()
2903 Old->isInlined() && !Old->hasAttr<GNUInlineAttr>()) { in MergeFunctionDecl()
2904 UndefinedButUsed.erase(Old->getCanonicalDecl()); in MergeFunctionDecl()
2909 if (Old->getNumParams() > 0 && Old->getNumParams() == New->getNumParams() && in MergeFunctionDecl()
2910 !hasIdenticalPassObjectSizeAttrs(Old, New)) { in MergeFunctionDecl()
2913 Diag(OldLocation, PrevDiag) << Old << Old->getType(); in MergeFunctionDecl()
2929 (Old->getTypeSourceInfo() in MergeFunctionDecl()
2930 ? Old->getTypeSourceInfo()->getType()->castAs<FunctionType>() in MergeFunctionDecl()
2950 Diag(OldLocation, PrevDiag) << Old << Old->getType() in MergeFunctionDecl()
2951 << Old->getReturnTypeSourceRange(); in MergeFunctionDecl()
2963 AutoType *OldAT = Old->getReturnType()->getContainedAutoType(); in MergeFunctionDecl()
2976 const CXXMethodDecl *OldMethod = dyn_cast<CXXMethodDecl>(Old); in MergeFunctionDecl()
2997 Diag(OldLocation, PrevDiag) << Old << Old->getType(); in MergeFunctionDecl()
3021 Diag(OldLocation, PrevDiag) << Old << Old->getType(); in MergeFunctionDecl()
3051 if (NRA && !Old->hasAttr<CXX11NoReturnAttr>()) { in MergeFunctionDecl()
3053 Diag(Old->getFirstDecl()->getLocation(), in MergeFunctionDecl()
3062 if (CDA && !Old->hasAttr<CarriesDependencyAttr>()) { in MergeFunctionDecl()
3065 Diag(Old->getFirstDecl()->getLocation(), in MergeFunctionDecl()
3084 if (haveIncompatibleLanguageLinkages(Old, New)) { in MergeFunctionDecl()
3104 return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); in MergeFunctionDecl()
3151 return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); in MergeFunctionDecl()
3166 Old->hasPrototype() && !New->hasPrototype() && in MergeFunctionDecl()
3168 Old->getNumParams() == New->getNumParams()) { in MergeFunctionDecl()
3172 = Old->getType()->getAs<FunctionProtoType>(); in MergeFunctionDecl()
3180 for (unsigned Idx = 0, End = Old->getNumParams(); in MergeFunctionDecl()
3182 ParmVarDecl *OldParm = Old->getParamDecl(Idx); in MergeFunctionDecl()
3212 return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); in MergeFunctionDecl()
3224 if (Old->isImplicit() && (BuiltinID = Old->getBuiltinID())) { in MergeFunctionDecl()
3230 << Old << Old->getType(); in MergeFunctionDecl()
3250 Diag(OldLocation, PrevDiag) << Old << Old->getType(); in MergeFunctionDecl()
3263 bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, in MergeCompatibleFunctionDecls() argument
3266 mergeDeclAttributes(New, Old); in MergeCompatibleFunctionDecls()
3269 if (Old->isPure()) in MergeCompatibleFunctionDecls()
3273 if (Old->getMostRecentDecl()->isUsed(false)) in MergeCompatibleFunctionDecls()
3278 if (New->getNumParams() == Old->getNumParams()) in MergeCompatibleFunctionDecls()
3281 ParmVarDecl *OldParam = Old->getParamDecl(i); in MergeCompatibleFunctionDecls()
3287 return MergeCXXFunctionDecl(New, Old, S); in MergeCompatibleFunctionDecls()
3292 QualType Merged = Context.mergeTypes(Old->getType(), New->getType()); in MergeCompatibleFunctionDecls()
3321 static void diagnoseVarDeclTypeMismatch(Sema &S, VarDecl *New, VarDecl* Old) { in diagnoseVarDeclTypeMismatch() argument
3322 assert(!S.Context.hasSameType(New->getType(), Old->getType())); in diagnoseVarDeclTypeMismatch()
3327 << New->getDeclName() << New->getType() << Old->getType(); in diagnoseVarDeclTypeMismatch()
3332 = getNoteDiagForInvalidRedeclaration(Old, New); in diagnoseVarDeclTypeMismatch()
3344 void Sema::MergeVarDeclTypes(VarDecl *New, VarDecl *Old, in MergeVarDeclTypes() argument
3346 if (New->isInvalidDecl() || Old->isInvalidDecl()) in MergeVarDeclTypes()
3354 } else if (Context.hasSameType(New->getType(), Old->getType())) { in MergeVarDeclTypes()
3356 return MergeVarDeclExceptionSpecs(New, Old); in MergeVarDeclTypes()
3363 else if (Old->getType()->isArrayType() && New->getType()->isArrayType()) { in MergeVarDeclTypes()
3364 const ArrayType *OldArray = Context.getAsArrayType(Old->getType()); in MergeVarDeclTypes()
3371 for (VarDecl *PrevVD = Old->getMostRecentDecl(); PrevVD; in MergeVarDeclTypes()
3393 MergedT = Old->getType(); in MergeVarDeclTypes()
3397 Old->getType()->isObjCObjectPointerType()) { in MergeVarDeclTypes()
3399 Old->getType()); in MergeVarDeclTypes()
3405 MergedT = Context.mergeTypes(New->getType(), Old->getType()); in MergeVarDeclTypes()
3414 Old->getType()->isDependentType()) && New->isLocalVarDecl()) { in MergeVarDeclTypes()
3422 return diagnoseVarDeclTypeMismatch(*this, New, Old); in MergeVarDeclTypes()
3479 VarDecl *Old = nullptr; in MergeVarDecl() local
3484 Old = OldTemplate ? OldTemplate->getTemplatedDecl() : nullptr; in MergeVarDecl()
3491 Old = dyn_cast<VarDecl>(Previous.getFoundDecl()); in MergeVarDecl()
3499 if (!Old) { in MergeVarDecl()
3518 if (Old->isStaticDataMember() && !New->isOutOfLine()) { in MergeVarDecl()
3521 Diag(Old->getLocation(), diag::note_previous_declaration); in MergeVarDecl()
3525 mergeDeclAttributes(New, Old); in MergeVarDecl()
3529 Old->getStorageClass() == SC_None && in MergeVarDecl()
3530 !Old->hasAttr<WeakImportAttr>()) { in MergeVarDecl()
3532 Diag(Old->getLocation(), diag::note_previous_definition); in MergeVarDecl()
3538 !Old->hasAttr<InternalLinkageAttr>()) { in MergeVarDecl()
3541 Diag(Old->getLocation(), diag::note_previous_definition); in MergeVarDecl()
3546 VarDecl *MostRecent = Old->getMostRecentDecl(); in MergeVarDecl()
3547 if (MostRecent != Old) { in MergeVarDecl()
3554 MergeVarDeclTypes(New, Old, mergeTypeWithPrevious(*this, New, Old, Previous)); in MergeVarDecl()
3561 getNoteDiagForInvalidRedeclaration(Old, New); in MergeVarDecl()
3566 Old->hasExternalFormalLinkage()) { in MergeVarDecl()
3587 if (New->hasExternalStorage() && Old->hasLinkage()) in MergeVarDecl()
3591 Old->getCanonicalDecl()->getStorageClass() == SC_Static) { in MergeVarDecl()
3599 !Old->hasLinkage() && Old->isLocalVarDeclOrParm()) { in MergeVarDecl()
3604 if (Old->hasLinkage() && New->isLocalVarDeclOrParm() && in MergeVarDecl()
3617 !(Old->getLexicalDeclContext()->isRecord() && in MergeVarDecl()
3624 if (New->isInline() && !Old->getMostRecentDecl()->isInline()) { in MergeVarDecl()
3625 if (VarDecl *Def = Old->getDefinition()) { in MergeVarDecl()
3636 if (!Old->isInline() && New->isInline() && Old->isUsed(false) && in MergeVarDecl()
3637 !Old->getDefinition() && !New->isThisDeclarationADefinition()) in MergeVarDecl()
3638 UndefinedButUsed.insert(std::make_pair(Old->getCanonicalDecl(), in MergeVarDecl()
3641 if (New->getTLSKind() != Old->getTLSKind()) { in MergeVarDecl()
3642 if (!Old->getTLSKind()) { in MergeVarDecl()
3663 (Def = Old->getDefinition())) { in MergeVarDecl()
3672 } else if (Old->isStaticDataMember() && in MergeVarDecl()
3673 Old->getCanonicalDecl()->isInline() && in MergeVarDecl()
3674 Old->getCanonicalDecl()->isConstexpr()) { in MergeVarDecl()
3686 if (haveIncompatibleLanguageLinkages(Old, New)) { in MergeVarDecl()
3694 if (Old->getMostRecentDecl()->isUsed(false)) in MergeVarDecl()
3698 New->setPreviousDecl(Old); in MergeVarDecl()
3703 New->setAccess(Old->getAccess()); in MergeVarDecl()
3707 if (Old->isInline()) in MergeVarDecl()
9568 if (VarDecl *Old = VDecl->getPreviousDecl()) { in AddInitializerToDecl() local
9571 MergeVarDeclTypes(VDecl, Old, /*MergeTypeWithPrevious*/ false); in AddInitializerToDecl()