diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-07-12 21:12:19 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-07-12 21:12:19 +0000 |
commit | cad8d31117800f804ee4f313134162edac8f8813 (patch) | |
tree | 7dd23c8cca1171c8ba7c577ecc40cc86b2e09cd8 /lib/AST/DeclBase.cpp | |
parent | 27cc6331e33efac4020058d2fda36c9060ec5afa (diff) |
Copy over attributes to instantiated variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108195 91177308-0d34-0410-b5e6-96231b3b80d8
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. |