return getAttrsImpl(); // Uncommon case, out of line hash lookup.
}
void swapAttrs(Decl *D);
- void copyAttrs(Decl *D);
void invalidateAttrs();
template<typename T> const T *getAttr() const {
RHS->HasAttrs = true;
}
-void Decl::copyAttrs(Decl *SRC) {
- if (!SRC->hasAttrs())
- return;
- ASTContext &Context = getASTContext();
- for (const Attr *attr = SRC->getAttrs(); attr; attr = attr->getNext()) {
- Attr *NewAttr = attr->clone(Context);
- addAttr(const_cast<Attr*>(NewAttr));
- }
- HasAttrs = true;
-}
-
-
void Decl::Destroy(ASTContext &C) {
// Free attributes for this decl.
if (HasAttrs) {
Owner->makeDeclVisibleInContext(Var);
} else {
Owner->addDecl(Var);
-
if (Owner->isFunctionOrMethod())
SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Var);
}
-
+ InstantiateAttrs(D, Var);
+
// Link instantiations of static data members back to the template from
// which they were instantiated.
if (Var->isStaticDataMember())
ParentDC->isFunctionOrMethod()) {
// D is a local of some kind. Look into the map of local
// declarations to their instantiations.
- NamedDecl *ND =
- cast<NamedDecl>(CurrentInstantiationScope->getInstantiationOf(D));
- ND->copyAttrs(D);
- return ND;
+ return cast<NamedDecl>(CurrentInstantiationScope->getInstantiationOf(D));
}
if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(D)) {