@@ -3839,11 +3839,10 @@ ImportDecl *swift::createImportDecl(ASTContext &Ctx,
38393839 ImportKind::Module, SourceLoc (),
38403840 importPath.get (), ClangN);
38413841 if (Ctx.ClangImporterOpts .BridgingHeaderIsInternal ) {
3842- ID->getAttrs ().add (
3843- new (Ctx) AccessControlAttr (SourceLoc (), SourceRange (),
3844- AccessLevel::Internal, /* implicit=*/ true ));
3842+ ID->addAttribute (new (Ctx) AccessControlAttr (
3843+ SourceLoc (), SourceRange (), AccessLevel::Internal, /* implicit=*/ true ));
38453844 } else if (IsExported) {
3846- ID->getAttrs (). add (new (Ctx) ExportedAttr (/* IsImplicit=*/ false ));
3845+ ID->addAttribute (new (Ctx) ExportedAttr (/* IsImplicit=*/ false ));
38473846 }
38483847 return ID;
38493848}
@@ -6263,39 +6262,39 @@ makeBaseClassMemberAccessors(DeclContext *declContext,
62636262
62646263// Clone attributes that have been imported from Clang.
62656264void cloneImportedAttributes (ValueDecl *fromDecl, ValueDecl* toDecl) {
6266- ASTContext& context = fromDecl->getASTContext ();
6267- DeclAttributes& attrs = toDecl->getAttrs ();
6265+ ASTContext &context = fromDecl->getASTContext ();
62686266 for (auto attr : fromDecl->getAttrs ()) {
62696267 switch (attr->getKind ()) {
62706268 case DeclAttrKind::Available: {
6271- attrs. add (cast<AvailableAttr>(attr)->clone (context, true ));
6269+ toDecl-> addAttribute (cast<AvailableAttr>(attr)->clone (context, true ));
62726270 break ;
62736271 }
62746272 case DeclAttrKind::Custom: {
62756273 CustomAttr *cAttr = cast<CustomAttr>(attr);
6276- attrs.add (CustomAttr::create (context, SourceLoc (), cAttr->getTypeExpr (),
6277- /* owner*/ toDecl, cAttr->getInitContext (),
6278- cAttr->getArgs (), /* implicit*/ true ));
6274+ toDecl->addAttribute (
6275+ CustomAttr::create (context, SourceLoc (), cAttr->getTypeExpr (),
6276+ /* owner*/ toDecl, cAttr->getInitContext (),
6277+ cAttr->getArgs (), /* implicit*/ true ));
62796278 break ;
62806279 }
62816280 case DeclAttrKind::DiscardableResult: {
6282- attrs. add (new (context) DiscardableResultAttr (true ));
6281+ toDecl-> addAttribute (new (context) DiscardableResultAttr (true ));
62836282 break ;
62846283 }
62856284 case DeclAttrKind::Effects: {
6286- attrs. add (cast<EffectsAttr>(attr)->clone (context));
6285+ toDecl-> addAttribute (cast<EffectsAttr>(attr)->clone (context));
62876286 break ;
62886287 }
62896288 case DeclAttrKind::Final: {
6290- attrs. add (new (context) FinalAttr (true ));
6289+ toDecl-> addAttribute (new (context) FinalAttr (true ));
62916290 break ;
62926291 }
62936292 case DeclAttrKind::Transparent: {
6294- attrs. add (new (context) TransparentAttr (true ));
6293+ toDecl-> addAttribute (new (context) TransparentAttr (true ));
62956294 break ;
62966295 }
62976296 case DeclAttrKind::WarnUnqualifiedAccess: {
6298- attrs. add (new (context) WarnUnqualifiedAccessAttr (true ));
6297+ toDecl-> addAttribute (new (context) WarnUnqualifiedAccessAttr (true ));
62996298 break ;
63006299 }
63016300 default :
@@ -7598,8 +7597,8 @@ static ValueDecl *addThunkForDependentTypes(FuncDecl *oldDecl,
75987597 newFnDecl->setBodySynthesizer (synthesizeDependentTypeThunkParamForwarding, newDecl);
75997598 newFnDecl->setSelfAccessKind (newDecl->getSelfAccessKind ());
76007599 if (newDecl->isStatic ()) newFnDecl->setStatic ();
7601- newFnDecl->getAttrs (). add (
7602- new (newDecl-> getASTContext ()) TransparentAttr (/* IsImplicit=*/ true ));
7600+ newFnDecl->addAttribute ( new (newDecl-> getASTContext ())
7601+ TransparentAttr (/* IsImplicit=*/ true ));
76037602 return newFnDecl;
76047603}
76057604
@@ -7725,8 +7724,8 @@ static ValueDecl *generateThunkForExtraMetatypes(SubstitutionMap subst,
77257724 thunk->setBodySynthesizer (synthesizeForwardingThunkBody, newDecl);
77267725 thunk->setSelfAccessKind (newDecl->getSelfAccessKind ());
77277726 if (newDecl->isStatic ()) thunk->setStatic ();
7728- thunk->getAttrs (). add (
7729- new (newDecl-> getASTContext ()) TransparentAttr (/* IsImplicit=*/ true ));
7727+ thunk->addAttribute ( new (newDecl-> getASTContext ())
7728+ TransparentAttr (/* IsImplicit=*/ true ));
77307729
77317730 return thunk;
77327731}
@@ -8998,7 +8997,7 @@ void ClangInheritanceInfo::setUnavailableIfNecessary(
89988997 msg = " this base member is not accessible because of private inheritance" ;
89998998
90008999 if (msg)
9001- clonedDecl->getAttrs (). add (AvailableAttr::createUniversallyUnavailable (
9000+ clonedDecl->addAttribute (AvailableAttr::createUniversallyUnavailable (
90029001 clonedDecl->getASTContext (), msg));
90039002}
90049003
0 commit comments