This was already done in SemaTemplateInstantiateDecl.cpp, but not in
SemaTemplateInstantiate.cpp.
Anecdotally I've seen some clangd crashes where coredumps point to this
being a problem, but I cannot reproduce this so far.
Differential Revision: https://reviews.llvm.org/D94933
Attr *NewAttr =
instantiateTemplateAttribute(I->TmplAttr, Context, *this, TemplateArgs);
- I->NewDecl->addAttr(NewAttr);
+ if (NewAttr)
+ I->NewDecl->addAttr(NewAttr);
LocalInstantiationScope::deleteScopes(I->Scope,
Instantiator.getStartingScope());
}