diff options
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 7288ae29a0..5ae7289ea5 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -28,6 +28,8 @@ namespace { DeclContext *Owner; const MultiLevelTemplateArgumentList &TemplateArgs; + void InstantiateAttrs(Decl *Tmpl, Decl *New); + public: typedef Sema::OwningExprResult OwningExprResult; @@ -89,6 +91,18 @@ namespace { }; } +// FIXME: Is this too simple? +void TemplateDeclInstantiator::InstantiateAttrs(Decl *Tmpl, Decl *New) { + for (const Attr *TmplAttr = Tmpl->getAttrs(); TmplAttr; + TmplAttr = TmplAttr->getNext()) { + + // FIXME: Is cloning correct for all attributes? + Attr *NewAttr = TmplAttr->clone(SemaRef.Context); + + New->addAttr(NewAttr); + } +} + Decl * TemplateDeclInstantiator::VisitTranslationUnitDecl(TranslationUnitDecl *D) { assert(false && "Translation units cannot be instantiated"); @@ -258,6 +272,8 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) { return 0; } + InstantiateAttrs(D, Field); + if (Invalid) Field->setInvalidDecl(); |