Home | History | Annotate | Download | only in Sema

Lines Matching defs:Old

1613     NamedDecl *old = filter.next();
1616 if (!old->isHidden())
1619 // If either has no-external linkage, ignore the old declaration.
1620 if (!hasExternalLinkage || old->getLinkage() != ExternalLinkage)
1627 bool Sema::isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New) {
1629 if (TypedefNameDecl *OldTypedef = dyn_cast<TypedefNameDecl>(Old))
1632 OldType = Context.getTypeDeclType(Old);
1637 int Kind = isa<TypeAliasDecl>(Old) ? 1 : 0;
1640 if (Old->getLocation().isValid())
1641 Diag(Old->getLocation(), diag::note_previous_definition);
1650 int Kind = isa<TypeAliasDecl>(Old) ? 1 : 0;
1653 if (Old->getLocation().isValid())
1654 Diag(Old->getLocation(), diag::note_previous_definition);
1662 /// same name and scope as a previous declaration 'Old'. Figure out
1712 // Verify the old decl was also a type.
1713 TypeDecl *Old = OldDecls.getAsSingle<TypeDecl>();
1714 if (!Old) {
1725 // If the old declaration is invalid, just give up here.
1726 if (Old->isInvalidDecl())
1731 if (isIncompatibleTypedef(Old, New))
1734 // The types match. Link up the redeclaration chain if the old
1736 if (TypedefNameDecl *Typedef = dyn_cast<TypedefNameDecl>(Old))
1771 if (!isa<TypedefNameDecl>(Old))
1776 Diag(Old->getLocation(), diag::note_previous_definition);
1789 (Context.getSourceManager().isInSystemHeader(Old->getLocation()) ||
1795 Diag(Old->getLocation(), diag::note_previous_definition);
1855 /// Merge alignment attributes from \p Old to \p New, taking into account the
1859 static bool mergeAlignedAttrs(Sema &S, NamedDecl *New, Decl *Old) {
1860 // Look for alignas attributes on Old, and pick out whichever attribute
1866 I = Old->specific_attr_begin<AlignedAttr>(),
1867 E = Old->specific_attr_end<AlignedAttr>(); I != E; ++I) {
1958 // Ensure we have an alignas attribute if the old declaration had one.
2040 static void checkNewAttributesAfterDef(Sema &S, Decl *New, const Decl *Old) {
2044 const Decl *Def = getDefinition(Old);
2088 /// mergeDeclAttributes - Copy attributes from the Old decl to the New one.
2089 void Sema::mergeDeclAttributes(NamedDecl *New, Decl *Old,
2091 if (!Old->hasAttrs() && !New->hasAttrs())
2095 checkNewAttributesAfterDef(*this, New, Old);
2097 if (!Old->hasAttrs())
2107 i = Old->specific_attr_begin<InheritableAttr>(),
2108 e = Old->specific_attr_end<InheritableAttr>();
2132 if (mergeAlignedAttrs(*this, New, Old))
2138 /// mergeParamDeclAttributes - Copy attributes from the old parameter
2244 static bool haveIncompatibleLanguageLinkages(const T *Old, const T *New) {
2245 const DeclContext *DC = Old->getDeclContext();
2249 LanguageLinkage OldLinkage = Old->getLanguageLinkage();
2261 /// declaration 'Old'. Figure out how to resolve this situation,
2264 /// In C++, New and Old must be declarations that are not
2265 /// overloaded. Use IsOverload to determine whether New and Old are
2266 /// overloaded, and to select the Old declaration that New should be
2271 // Verify the old decl was also a function.
2272 FunctionDecl *Old = 0;
2275 Old = OldFunctionTemplate->getTemplatedDecl();
2277 Old = dyn_cast<FunctionDecl>(OldD);
2278 if (!Old) {
2297 if (Old->isThisDeclarationADefinition())
2299 else if (Old->isImplicit())
2304 QualType OldQType = Context.getCanonicalType(Old->getType());
2307 // Don't complain about this if we're in GNU89 mode and the old function
2309 if (!isa<CXXMethodDecl>(New) && !isa<CXXMethodDecl>(Old) &&
2311 Old->getStorageClass() != SC_Static &&
2312 !canRedefineFunction(Old, getLangOpts())) {
2315 Diag(Old->getLocation(), PrevDiag);
2318 Diag(Old->getLocation(), PrevDiag);
2353 // effectively the same as the explict one. Only Old decl contains correct
2356 isABIDefaultCC(*this, NewTypeInfo.getCC(), Old)) {
2368 Diag(Old->getLocation(), diag::note_previous_declaration);
2385 Diag(Old->getLocation(), diag::note_previous_declaration);
2397 Diag(Old->getLocation(), diag::note_previous_declaration);
2413 if (!Old->isInlined() && New->isInlined() &&
2416 Old->isUsed(false) &&
2417 !Old->isDefined() && !New->isThisDeclarationADefinition())
2418 UndefinedButUsed.insert(std::make_pair(Old->getCanonicalDecl(),
2424 Old->isInlined() && !Old->hasAttr<GNUInlineAttr>()) {
2425 UndefinedButUsed.erase(Old->getCanonicalDecl());
2446 Diag(Old->getLocation(), PrevDiag) << Old << Old->getType();
2453 const CXXMethodDecl* OldMethod = dyn_cast<CXXMethodDecl>(Old);
2474 Diag(Old->getLocation(), PrevDiag) << Old << Old->getType();
2498 Diag(Old->getLocation(), PrevDiag) << Old << Old->getType();
2527 !Old->hasAttr<CXX11NoReturnAttr>()) {
2530 Diag(Old->getFirstDeclaration()->getLocation(),
2539 !Old->hasAttr<CarriesDependencyAttr>()) {
2542 Diag(Old->getFirstDeclaration()->getLocation(),
2551 // noreturn should now match unless the old type info didn't have it.
2561 if (haveIncompatibleLanguageLinkages(Old, New)) {
2563 Diag(Old->getLocation(), PrevDiag);
2568 return MergeCompatibleFunctionDecls(New, Old, S);
2582 // The old declaration provided a function prototype, but the
2613 return MergeCompatibleFunctionDecls(New, Old, S);
2628 Old->hasPrototype() && !New->hasPrototype() &&
2630 Old->getNumParams() == New->getNumParams()) {
2634 = Old->getType()->getAs<FunctionProtoType>();
2642 for (unsigned Idx = 0, End = Old->getNumParams();
2644 ParmVarDecl *OldParm = Old->getParamDecl(Idx);
2673 return MergeCompatibleFunctionDecls(New, Old, S);
2681 if (unsigned BuiltinID = Old->getBuiltinID()) {
2690 Diag(Old->getLocation(), diag::note_previous_builtin_declaration)
2691 << Old << Old->getType();
2693 Old->setInvalidDecl();
2701 Diag(Old->getLocation(), PrevDiag) << Old << Old->getType();
2709 /// properties of function declarations form the old declaration to
2711 /// redeclaration of Old.
2714 bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old,
2717 mergeDeclAttributes(New, Old);
2720 if (Old->getStorageClass() != SC_Extern &&
2721 Old->getStorageClass() != SC_None)
2722 New->setStorageClass(Old->getStorageClass());
2725 if (Old->isPure())
2729 if (Old->isUsed(false))
2734 if (New->getNumParams() == Old->getNumParams())
2736 mergeParamDeclAttributes(New->getParamDecl(i), Old->getParamDecl(i),
2740 return MergeCXXFunctionDecl(New, Old, S);
2744 QualType Merged = Context.mergeTypes(Old->getType(), New->getType());
2770 /// scope as a previous declaration 'Old'. Figure out how to merge their types,
2776 void Sema::MergeVarDeclTypes(VarDecl *New, VarDecl *Old) {
2777 if (New->isInvalidDecl() || Old->isInvalidDecl())
2786 } else if (Context.hasSameType(New->getType(), Old->getType())) {
2788 return MergeVarDeclExceptionSpecs(New, Old);
2795 else if (Old->getType()->isIncompleteArrayType() &&
2797 const ArrayType *OldArray = Context.getAsArrayType(Old->getType());
2802 } else if (Old->getType()->isArrayType() &&
2804 const ArrayType *OldArray = Context.getAsArrayType(Old->getType());
2808 MergedT = Old->getType();
2810 && Old->getType()->isObjCObjectPointerType()) {
2812 Old->getType());
2815 MergedT = Context.mergeTypes(New->getType(), Old->getType());
2819 << New->getDeclName() << New->getType() << Old->getType();
2820 Diag(Old->getLocation(), diag::note_previous_definition);
2827 /// and scope as a previous declaration 'Old'. Figure out how to resolve this
2839 // Verify the old decl was also a variable.
2840 VarDecl *Old = 0;
2842 !(Old = dyn_cast<VarDecl>(Previous.getFoundDecl()))) {
2854 if (Old->isStaticDataMember() && !New->isOutOfLine()) {
2857 Diag(Old->getLocation(), diag::note_previous_declaration);
2861 mergeDeclAttributes(New, Old);
2865 Old->getStorageClass() == SC_None &&
2866 !Old->getAttr<WeakImportAttr>()) {
2868 Diag(Old->getLocation(), diag::note_previous_definition);
2874 MergeVarDeclTypes(New, Old);
2880 (Old->getStorageClass() == SC_None || Old->hasExternalStorage())) {
2882 Diag(Old->getLocation(), diag::note_previous_definition);
2894 if (New->hasExternalStorage() && Old->hasLinkage())
2897 Old->getStorageClass() == SC_Static) {
2899 Diag(Old->getLocation(), diag::note_previous_definition);
2905 !Old->hasLinkage() && Old->isLocalVarDecl()) {
2907 Diag(Old->getLocation(), diag::note_previous_definition);
2910 if (Old->hasExternalStorage() &&
2913 Diag(Old->getLocation(), diag::note_previous_definition);
2923 !(Old->getLexicalDeclContext()->isRecord() &&
2926 Diag(Old->getLocation(), diag::note_previous_definition);
2930 if (New->isThreadSpecified() && !Old->isThreadSpecified()) {
2932 Diag(Old->getLocation(), diag::note_previous_definition);
2933 } else if (!New->isThreadSpecified() && Old->isThreadSpecified()) {
2935 Diag(Old->getLocation(), diag::note_previous_definition);
2942 (Def = Old->getDefinition())) {
2950 if (haveIncompatibleLanguageLinkages(Old, New)) {
2952 Diag(Old->getLocation(), diag::note_previous_definition);
2965 Old->getLinkage() == InternalLinkage)
2966 New->setStorageClass(Old->getStorageClass());
2969 if (Old->isUsed(false))
2973 New->setPreviousDeclaration(Old);
2976 New->setAccess(Old->getAccess());
6450 // extension for compatibility with old SWIG code which likes to
7264 if (VarDecl *Old = VDecl->getPreviousDecl())
7265 MergeVarDeclTypes(VDecl, Old);