summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-07 20:08:42 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-07 20:08:42 +0000
commitdbc5daf05882c1c1934b35d5899b6ca53ce4cff9 (patch)
treeaf766082edf0c17460eb8950a94a9b87000fec02 /clang/lib/AST/DeclCXX.cpp
parentcb0df597e0f7f43b14cbed1f9dd1f39b22fe08be (diff)
downloadbcm5719-llvm-dbc5daf05882c1c1934b35d5899b6ca53ce4cff9.tar.gz
bcm5719-llvm-dbc5daf05882c1c1934b35d5899b6ca53ce4cff9.zip
Parsing, ASTs, and semantic analysis for the declaration of conversion
functions in C++, e.g., struct X { operator bool() const; }; Note that these conversions don't actually do anything, since we don't yet have the ability to use them for implicit or explicit conversions. llvm-svn: 58860
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r--clang/lib/AST/DeclCXX.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index b0df75b404d..b2878b667aa 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -48,6 +48,11 @@ void CXXRecordDecl::Destroy(ASTContext &C) {
if (isDefinition())
Destructor->Destroy(C);
+ for (OverloadedFunctionDecl::function_iterator func
+ = Conversions.function_begin();
+ func != Conversions.function_end(); ++func)
+ (*func)->Destroy(C);
+
RecordDecl::Destroy(C);
}
@@ -101,6 +106,11 @@ CXXRecordDecl::addConstructor(ASTContext &Context,
Constructors.addOverload(ConDecl);
}
+void CXXRecordDecl::addConversionFunction(ASTContext &Context,
+ CXXConversionDecl *ConvDecl) {
+ Conversions.addOverload(ConvDecl);
+}
+
CXXMethodDecl *
CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, IdentifierInfo *Id,
@@ -232,6 +242,14 @@ CXXDestructorDecl::Create(ASTContext &C, CXXRecordDecl *RD,
isImplicitlyDeclared);
}
+CXXConversionDecl *
+CXXConversionDecl::Create(ASTContext &C, CXXRecordDecl *RD,
+ SourceLocation L, IdentifierInfo *Id,
+ QualType T, bool isInline, bool isExplicit) {
+ void *Mem = C.getAllocator().Allocate<CXXConversionDecl>();
+ return new (Mem) CXXConversionDecl(RD, L, Id, T, isInline, isExplicit);
+}
+
CXXClassVarDecl *CXXClassVarDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, IdentifierInfo *Id,
QualType T, ScopedDecl *PrevDecl) {
OpenPOWER on IntegriCloud