summaryrefslogtreecommitdiffstats
path: root/clang/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
commit5251f1b28324a1af9812b5234eeafa904f42706c (patch)
treea07a945501d2a4f68bd1e0e36321000c4c6beb9b /clang/lib/AST/DeclSerialization.cpp
parent0747e7e025b3b07f2582739d5df0a5648b05fd5b (diff)
downloadbcm5719-llvm-5251f1b28324a1af9812b5234eeafa904f42706c.tar.gz
bcm5719-llvm-5251f1b28324a1af9812b5234eeafa904f42706c.zip
Preliminary support for function overloading
llvm-svn: 57909
Diffstat (limited to 'clang/lib/AST/DeclSerialization.cpp')
-rw-r--r--clang/lib/AST/DeclSerialization.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclSerialization.cpp b/clang/lib/AST/DeclSerialization.cpp
index a0befbdbb08..f2aa3f30276 100644
--- a/clang/lib/AST/DeclSerialization.cpp
+++ b/clang/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.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud