aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/DeclBase.cpp12
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp9
2 files changed, 3 insertions, 18 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index ddedc65a1b..d4f997de76 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -372,18 +372,6 @@ void Decl::swapAttrs(Decl *RHS) {
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) {
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 3a0e43672d..2fd3528532 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -396,11 +396,11 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
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())
@@ -2591,10 +2591,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
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)) {