mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "swift/Demangling/ManglingMacros.h"
|
||||
#include "swift/Serialization/SerializationOptions.h"
|
||||
#include "swift/Strings.h"
|
||||
#include "clang/AST/DeclTemplate.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
@@ -73,6 +74,7 @@ using namespace llvm::support;
|
||||
using swift::version::Version;
|
||||
using llvm::BCBlockRAII;
|
||||
|
||||
|
||||
ASTContext &SerializerBase::getASTContext() {
|
||||
return M->getASTContext();
|
||||
}
|
||||
@@ -626,13 +628,25 @@ DeclID Serializer::addDeclRef(const Decl *D, bool allowTypeAliasXRef) {
|
||||
}
|
||||
|
||||
serialization::TypeID Serializer::addTypeRef(Type ty) {
|
||||
Type typeToSerialize = ty;
|
||||
if (ty) {
|
||||
if (auto nominalDecl = ty->getAnyNominal()) {
|
||||
if (auto structDecl = dyn_cast<StructDecl>(nominalDecl)) {
|
||||
if (auto templateInstantiationType =
|
||||
structDecl->getTemplateInstantiationType()) {
|
||||
typeToSerialize = templateInstantiationType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
PrettyStackTraceType trace(M->getASTContext(), "serializing", ty);
|
||||
PrettyStackTraceType trace(M->getASTContext(), "serializing", typeToSerialize);
|
||||
assert(M->getASTContext().LangOpts.AllowModuleWithCompilerErrors ||
|
||||
!ty || !ty->hasError() && "serializing type with an error");
|
||||
!typeToSerialize || !typeToSerialize->hasError() && "serializing type with an error");
|
||||
#endif
|
||||
|
||||
return TypesToSerialize.addRef(ty);
|
||||
return TypesToSerialize.addRef(typeToSerialize);
|
||||
}
|
||||
|
||||
serialization::ClangTypeID Serializer::addClangTypeRef(const clang::Type *ty) {
|
||||
|
||||
Reference in New Issue
Block a user