diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-22 23:33:22 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-22 23:33:22 +0000 |
commit | d28ac5b9981993a6ae527c155e4385b8afad6ac7 (patch) | |
tree | bad015f1f91016bb4d218e8e4512230a009b0ac3 /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | 62e5f4de3d968e8f1c6b620a0dc6324562720c9d (diff) | |
download | bcm5719-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/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index c186ba00ee5..d6660e8b9b4 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2944,6 +2944,24 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, Reader.ReadSourceLocation(ModuleFile, Record, Idx)); break; + case UPD_CXX_INSTANTIATED_FUNCTION_DEFINITION: { + FunctionDecl *FD = cast<FunctionDecl>(D); + if (FD->hasBody() || Reader.PendingBodies[FD]) + // FIXME: Maybe check for ODR violations. + break; + + if (Record[Idx++]) + FD->setImplicitlyInline(); + FD->setInnerLocStart(Reader.ReadSourceLocation(ModuleFile, Record, Idx)); + if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) + std::tie(CD->CtorInitializers, CD->NumCtorInitializers) = + Reader.ReadCXXCtorInitializers(ModuleFile, Record, Idx); + // Store the offset of the body so we can lazily load it later. + Reader.PendingBodies[FD] = GetCurrentCursorOffset(); + assert(Idx == Record.size() && "lazy body must be last"); + break; + } + case UPD_CXX_RESOLVED_EXCEPTION_SPEC: { auto *FD = cast<FunctionDecl>(D); auto *FPT = FD->getType()->castAs<FunctionProtoType>(); |