Skip to content

Commit 8e63a4b

Browse files
[Serialization] Gate Clang type (de)serialization behind UseClangFunctionTypes.
1 parent ea0da3f commit 8e63a4b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5799,6 +5799,9 @@ class SwiftToClangBasicReader :
57995799

58005800
llvm::Expected<const clang::Type *>
58015801
ModuleFile::getClangType(ClangTypeID TID) {
5802+
if (!getContext().LangOpts.UseClangFunctionTypes)
5803+
return nullptr;
5804+
58025805
if (TID == 0)
58035806
return nullptr;
58045807

lib/Serialization/Serialization.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4140,7 +4140,10 @@ class Serializer::TypeSerializer : public TypeVisitor<TypeSerializer> {
41404140
using namespace decls_block;
41414141

41424142
auto resultType = S.addTypeRef(fnTy->getResult());
4143-
auto clangType = S.addClangTypeRef(fnTy->getClangTypeInfo().getType());
4143+
auto clangType =
4144+
S.getASTContext().LangOpts.UseClangFunctionTypes
4145+
? S.addClangTypeRef(fnTy->getClangTypeInfo().getType())
4146+
: ClangTypeID(0);
41444147

41454148
unsigned abbrCode = S.DeclTypeAbbrCodes[FunctionTypeLayout::Code];
41464149
FunctionTypeLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,

0 commit comments

Comments
 (0)