summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-03-22 23:33:22 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-03-22 23:33:22 +0000
commitd28ac5b9981993a6ae527c155e4385b8afad6ac7 (patch)
treebad015f1f91016bb4d218e8e4512230a009b0ac3 /clang/lib/Serialization/ASTWriterDecl.cpp
parent62e5f4de3d968e8f1c6b620a0dc6324562720c9d (diff)
downloadbcm5719-llvm-d28ac5b9981993a6ae527c155e4385b8afad6ac7.tar.gz
bcm5719-llvm-d28ac5b9981993a6ae527c155e4385b8afad6ac7.zip
Emit an update record if we instantiate the definition of a function template
specialization from a module. (This can also happen for function template specializations in PCHs if they're instantiated eagerly, because they're constexpr or have a deduced return type.) llvm-svn: 204547
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriterDecl.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 7ee4e31978c..d83b3ede38e 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -130,6 +130,14 @@ namespace clang {
void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
+
+ void AddFunctionDefinition(const FunctionDecl *FD) {
+ assert(FD->doesThisDeclarationHaveABody());
+ if (auto *CD = dyn_cast<CXXConstructorDecl>(FD))
+ Writer.AddCXXCtorInitializers(CD->CtorInitializers,
+ CD->NumCtorInitializers, Record);
+ Writer.AddStmt(FD->getBody());
+ }
};
}
@@ -1894,3 +1902,11 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
if (isRequiredDecl(D, Context))
EagerlyDeserializedDecls.push_back(ID);
}
+
+void ASTWriter::AddFunctionDefinition(const FunctionDecl *FD,
+ RecordData &Record) {
+ ClearSwitchCaseIDs();
+
+ ASTDeclWriter W(*this, FD->getASTContext(), Record);
+ W.AddFunctionDefinition(FD);
+}
OpenPOWER on IntegriCloud