aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclSerialization.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-10-21 16:13:35 +0000
committerDouglas Gregor <dgregor@apple.com>2008-10-21 16:13:35 +0000
commit8e9bebdea69c590dedfbf27374114cb76fe12fbd (patch)
treea23d60f1da3648dcff20b6db034b2f5bf30ac50f /lib/AST/DeclSerialization.cpp
parent6d34893fc886f4153f104de8880876764981cb7f (diff)
Preliminary support for function overloading
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclSerialization.cpp')
-rw-r--r--lib/AST/DeclSerialization.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index a0befbdbb0..f2aa3f3027 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -13,6 +13,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
#include "llvm/Bitcode/Serialize.h"
#include "llvm/Bitcode/Deserialize.h"
@@ -74,7 +75,11 @@ Decl* Decl::Create(Deserializer& D, ASTContext& C) {
case Function:
Dcl = FunctionDecl::CreateImpl(D, C);
break;
-
+
+ case OverloadedFunction:
+ Dcl = OverloadedFunctionDecl::CreateImpl(D, C);
+ break;
+
case Record:
Dcl = RecordDecl::CreateImpl(D, C);
break;
@@ -455,6 +460,34 @@ BlockDecl* BlockDecl::CreateImpl(Deserializer& D, ASTContext& C) {
}
//===----------------------------------------------------------------------===//
+// OverloadedFunctionDecl Serialization.
+//===----------------------------------------------------------------------===//
+
+void OverloadedFunctionDecl::EmitImpl(Serializer& S) const {
+ NamedDecl::EmitInRec(S);
+
+ S.EmitInt(getNumFunctions());
+ for (unsigned func = 0; func < getNumFunctions(); ++func)
+ S.EmitPtr(Functions[func]);
+}
+
+OverloadedFunctionDecl *
+OverloadedFunctionDecl::CreateImpl(Deserializer& D, ASTContext& C) {
+ void *Mem = C.getAllocator().Allocate<OverloadedFunctionDecl>();
+ OverloadedFunctionDecl* decl = new (Mem)
+ OverloadedFunctionDecl(0, NULL);
+
+ decl->NamedDecl::ReadInRec(D, C);
+
+ unsigned numFunctions = D.ReadInt();
+ decl->Functions.reserve(numFunctions);
+ for (unsigned func = 0; func < numFunctions; ++func)
+ D.ReadPtr(decl->Functions[func]);
+
+ return decl;
+}
+
+//===----------------------------------------------------------------------===//
// RecordDecl Serialization.
//===----------------------------------------------------------------------===//