diff options
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 9027a13143..ddedc65a1b 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -372,6 +372,17 @@ 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. |