Skip to content

Commit fdb5037

Browse files
committed
[clang][p2719] Module deserialization does not restore allocator flags
When serializing and deserializing a FunctionDecl we don't recover whether or not the decl was a type aware allocator or destroying delete, because in the final PR that information was placed in a side table in ASTContext. In principle it should be possible to re-do the semantic checks to determine what these flags should be when deserializing, but it seems like the most robust path is simply recording the flags directly in the serialized AST.
1 parent 0400b8e commit fdb5037

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

clang/lib/Serialization/ASTReaderDecl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,8 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
10761076
FD->setFriendConstraintRefersToEnclosingTemplate(
10771077
FunctionDeclBits.getNextBit());
10781078
FD->setUsesSEHTry(FunctionDeclBits.getNextBit());
1079+
FD->setIsDestroyingOperatorDelete(FunctionDeclBits.getNextBit());
1080+
FD->setIsTypeAwareOperatorNewOrDelete(FunctionDeclBits.getNextBit());
10791081

10801082
FD->EndRangeLoc = readSourceLocation();
10811083
if (FD->isExplicitlyDefaulted())
@@ -1160,6 +1162,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
11601162
C.registerSYCLEntryPointFunction(FD);
11611163
}
11621164
}
1165+
11631166
}
11641167

11651168
void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {

clang/lib/Serialization/ASTWriterDecl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,8 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
847847
FunctionDeclBits.addBit(D->isInstantiatedFromMemberTemplate());
848848
FunctionDeclBits.addBit(D->FriendConstraintRefersToEnclosingTemplate());
849849
FunctionDeclBits.addBit(D->usesSEHTry());
850+
FunctionDeclBits.addBit(D->isDestroyingOperatorDelete());
851+
FunctionDeclBits.addBit(D->isTypeAwareOperatorNewOrDelete());
850852
Record.push_back(FunctionDeclBits);
851853

852854
Record.AddSourceLocation(D->getEndLoc());

0 commit comments

Comments
 (0)