aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-10-31 09:07:45 +0000
committerDouglas Gregor <dgregor@apple.com>2008-10-31 09:07:45 +0000
commitb48fe3812047e84164925c8938ce82be0624c40c (patch)
tree8af13a860c7c055c80382ca3f0b1f9f2db7b7b23 /lib/AST/DeclCXX.cpp
parente10b0f236bc8487445bc99b8d14bd40666b1998d (diff)
Add support for parsing and representing C++ constructor declarations.
Notes: - Constructors are never found by name lookup, so they'll never get pushed into any scope. Instead, they are stored as an OverloadedFunctionDecl in CXXRecordDecl for easy overloading. - There's a new action isCurrentClassName that determines whether an identifier is the name of the innermost class currently being defined; we use this to identify the declarator-id grammar rule that refers to a type-name. - MinimalAction does *not* support parsing constructors. - We now handle virtual and explicit function specifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclCXX.cpp')
-rw-r--r--lib/AST/DeclCXX.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 0d0b746ad6..3ec6824566 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -39,6 +39,14 @@ CXXRecordDecl::~CXXRecordDecl() {
delete [] Bases;
}
+void CXXRecordDecl::Destroy(ASTContext &C) {
+ for (OverloadedFunctionDecl::function_iterator func
+ = Constructors.function_begin();
+ func != Constructors.function_end(); ++func)
+ (*func)->Destroy(C);
+ RecordDecl::Destroy(C);
+}
+
void
CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
unsigned NumBases) {
@@ -74,6 +82,17 @@ QualType CXXMethodDecl::getThisType(ASTContext &C) const {
return C.getPointerType(ClassTy).withConst();
}
+CXXConstructorDecl *
+CXXConstructorDecl::Create(ASTContext &C, CXXRecordDecl *RD,
+ SourceLocation L, IdentifierInfo *Id,
+ QualType T, bool isExplicit,
+ bool isInline, bool isImplicitlyDeclared) {
+ void *Mem = C.getAllocator().Allocate<CXXConstructorDecl>();
+ return new (Mem) CXXConstructorDecl(RD, L, Id, T, isExplicit, isInline,
+ isImplicitlyDeclared);
+}
+
+
CXXClassVarDecl *CXXClassVarDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, IdentifierInfo *Id,
QualType T, ScopedDecl *PrevDecl) {