Merge remote-tracking branch 'origin/main' into rebranch

This commit is contained in:
swift-ci
2021-01-27 04:12:41 -08:00
81 changed files with 1085 additions and 565 deletions

View File

@@ -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) {