diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-27 21:17:54 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-27 21:17:54 +0000 |
commit | 5c0646b98b203d105c10ad8cc11be11cc99a4218 (patch) | |
tree | 43688f89eef98e841e49a02ed9e1ab4976fa972c /lib/AST/DeclBase.cpp | |
parent | c956b6e8ff909858cec5832f024d2af9c58f190b (diff) |
Clean up the handling of the DeclaredDefaultConstructor and
DeclaredCopyConstructor bits in CXXRecordDecl's DefinitionData
structure. Rather than having Sema call addedConstructor or set the
bits directly at semi-random places, move all of the logic for
managing these bits into CXXRecordDecl itself and tie the
addedConstructor call into DeclContext::addDecl().
This makes it easier for AST-building clients to get the right bits
set in DefinitionData, and is one small part of <rdar://problem/8459981>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114889 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index f629722793..207edde592 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -778,6 +778,14 @@ void DeclContext::addHiddenDecl(Decl *D) { } else { FirstDecl = LastDecl = D; } + + if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(this)) { + Decl *InnerD = D; + if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(D)) + InnerD = FunTmpl->getTemplatedDecl(); + if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(InnerD)) + Record->addedConstructor(Constructor); + } } void DeclContext::addDecl(Decl *D) { |