diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-08-07 18:53:08 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-08-07 18:53:08 +0000 |
commit | 4d2357948b6a5c4e232fa988c364e4dcd0193288 (patch) | |
tree | b3753f028bcea5ed0cb09da6ea9cff997583a1b1 /clang/lib/Serialization/ASTWriter.cpp | |
parent | 54c340b76add6aa394c0564252df893698f9678f (diff) | |
download | bcm5719-llvm-4d2357948b6a5c4e232fa988c364e4dcd0193288.tar.gz bcm5719-llvm-4d2357948b6a5c4e232fa988c364e4dcd0193288.zip |
[modules] When emitting an update record containing the body of a destructor,
also emit the updated 'operator delete' looked up for that destructor. Switch
from UpdateDecl to an actual update record when this happens due to implicitly
defining a special member function and unify this code path and the one for
instantiating a function definition.
llvm-svn: 215132
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 8de1fca05f4..baed95ebf84 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4629,17 +4629,17 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { Record.push_back(GetDeclRef(Update.getDecl())); break; - case UPD_CXX_INSTANTIATED_STATIC_DATA_MEMBER: - AddSourceLocation(Update.getLoc(), Record); - break; - - case UPD_CXX_INSTANTIATED_FUNCTION_DEFINITION: + case UPD_CXX_ADDED_FUNCTION_DEFINITION: // An updated body is emitted last, so that the reader doesn't need // to skip over the lazy body to reach statements for other records. Record.pop_back(); HasUpdatedBody = true; break; + case UPD_CXX_INSTANTIATED_STATIC_DATA_MEMBER: + AddSourceLocation(Update.getLoc(), Record); + break; + case UPD_CXX_INSTANTIATED_CLASS_DEFINITION: { auto *RD = cast<CXXRecordDecl>(D); AddUpdatedDeclContext(RD->getPrimaryContext()); @@ -4709,10 +4709,12 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { if (HasUpdatedBody) { const FunctionDecl *Def = cast<FunctionDecl>(D); - Record.push_back(UPD_CXX_INSTANTIATED_FUNCTION_DEFINITION); + Record.push_back(UPD_CXX_ADDED_FUNCTION_DEFINITION); Record.push_back(Def->isInlined()); AddSourceLocation(Def->getInnerLocStart(), Record); AddFunctionDefinition(Def, Record); + if (auto *DD = dyn_cast<CXXDestructorDecl>(Def)) + Record.push_back(GetDeclRef(DD->getOperatorDelete())); } OffsetsRecord.push_back(GetDeclRef(D)); @@ -5704,9 +5706,8 @@ void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) { if (!D->isFromASTFile()) return; // Declaration not imported from PCH. - // Implicit decl from a PCH was defined. - // FIXME: Should implicit definition be a separate FunctionDecl? - RewriteDecl(D); + // Implicit function decl from a PCH was defined. + DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_ADDED_FUNCTION_DEFINITION)); } void ASTWriter::FunctionDefinitionInstantiated(const FunctionDecl *D) { @@ -5714,10 +5715,8 @@ void ASTWriter::FunctionDefinitionInstantiated(const FunctionDecl *D) { if (!D->isFromASTFile()) return; - // Since the actual instantiation is delayed, this really means that we need - // to update the instantiation location. DeclUpdates[D].push_back( - DeclUpdate(UPD_CXX_INSTANTIATED_FUNCTION_DEFINITION)); + DeclUpdate(UPD_CXX_ADDED_FUNCTION_DEFINITION)); } void ASTWriter::StaticDataMemberInstantiated(const VarDecl *D) { |