diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-03-10 01:41:22 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-03-10 01:41:22 +0000 |
commit | f81340096ddf2b5a75eee94a09ad30a7501ed816 (patch) | |
tree | b3786a40e60f737643a705af917ae285ecf0a903 /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | 63acdfdeb26616dfa1d9657fa666afc9b9440a2a (diff) | |
download | bcm5719-llvm-f81340096ddf2b5a75eee94a09ad30a7501ed816.tar.gz bcm5719-llvm-f81340096ddf2b5a75eee94a09ad30a7501ed816.zip |
[modules] Don't clobber a destructor's operator delete when adding another one;
move the operator delete updating into a separate update record so we can cope
with updating another module's destructor's operator delete.
llvm-svn: 231735
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 5aeb3d1e517..2a01d853c7c 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1620,7 +1620,12 @@ void ASTDeclReader::VisitCXXConstructorDecl(CXXConstructorDecl *D) { void ASTDeclReader::VisitCXXDestructorDecl(CXXDestructorDecl *D) { VisitCXXMethodDecl(D); - D->OperatorDelete = ReadDeclAs<FunctionDecl>(Record, Idx); + if (auto *OperatorDelete = ReadDeclAs<FunctionDecl>(Record, Idx)) { + auto *Canon = cast<CXXDestructorDecl>(D->getCanonicalDecl()); + // FIXME: Check consistency if we have an old and new operator delete. + if (!Canon->OperatorDelete) + Canon->OperatorDelete = OperatorDelete; + } } void ASTDeclReader::VisitCXXConversionDecl(CXXConversionDecl *D) { @@ -3621,10 +3626,6 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) std::tie(CD->CtorInitializers, CD->NumCtorInitializers) = Reader.ReadCXXCtorInitializers(ModuleFile, Record, Idx); - if (auto *DD = dyn_cast<CXXDestructorDecl>(FD)) - // FIXME: Check consistency. - DD->setOperatorDelete(Reader.ReadDeclAs<FunctionDecl>(ModuleFile, - Record, Idx)); // Store the offset of the body so we can lazily load it later. Reader.PendingBodies[FD] = GetCurrentCursorOffset(); HasPendingBody = true; @@ -3691,6 +3692,17 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, break; } + case UPD_CXX_RESOLVED_DTOR_DELETE: { + // Set the 'operator delete' directly to avoid emitting another update + // record. + auto *Del = Reader.ReadDeclAs<FunctionDecl>(ModuleFile, Record, Idx); + auto *First = cast<CXXDestructorDecl>(D->getCanonicalDecl()); + // FIXME: Check consistency if we have an old and new operator delete. + if (!First->OperatorDelete) + First->OperatorDelete = Del; + break; + } + case UPD_CXX_RESOLVED_EXCEPTION_SPEC: { // FIXME: This doesn't send the right notifications if there are // ASTMutationListeners other than an ASTWriter. |