Skip to content

Commit 5b29319

Browse files
authored
Merge pull request #67167 from hyp/eng/d35896efa5703fce2aaf9ffa6caad9fa2ce35c41
[interop] do not warn about a template with too many specializations …
2 parents 145cf9e + 8ed840f commit 5b29319

File tree

6 files changed

+3034
-14
lines changed

6 files changed

+3034
-14
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ WARNING(libstdcxx_modulemap_not_found, none,
128128
"module map for libstdc++ not found for '%0'; C++ stdlib may be unavailable",
129129
(StringRef))
130130

131-
WARNING(too_many_class_template_instantiations, none,
132-
"template instantiation for '%0' not imported: too many instantiations",
133-
(StringRef))
134-
135131
WARNING(api_pattern_attr_ignored, none,
136132
"'%0' swift attribute ignored on type '%1': type is not copyable or destructible",
137133
(StringRef, StringRef))

lib/ClangImporter/ImportDecl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,12 +2914,12 @@ namespace {
29142914
if (size_t(
29152915
llvm::size(decl->getSpecializedTemplate()->specializations())) >
29162916
specializationLimit) {
2917-
std::string name;
2918-
llvm::raw_string_ostream os(name);
2919-
decl->printQualifiedName(os);
2920-
// Emit a warning if we haven't warned about this decl yet.
2921-
if (Impl.tooDeepTemplateSpecializations.insert(name).second)
2922-
Impl.diagnose({}, diag::too_many_class_template_instantiations, name);
2917+
// Note: it would be nice to import a dummy unavailable struct,
2918+
// but we would then need to instantiate the template here,
2919+
// as we cannot import a struct without a definition. That would
2920+
// defeat the purpose. Also, we can't make the dummy
2921+
// struct simply unavailable, as that still makes the
2922+
// typelias that references it available.
29232923
return nullptr;
29242924
}
29252925

lib/ClangImporter/ImporterImpl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,6 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
655655
llvm::DenseMap<clang::FunctionDecl *, ValueDecl *>
656656
specializedFunctionTemplates;
657657

658-
/// Stores qualified names of C++ template specializations that were too deep
659-
/// to import into Swift.
660-
llvm::StringSet<> tooDeepTemplateSpecializations;
661-
662658
/// Keeps track of the Clang functions that have been turned into
663659
/// properties.
664660
llvm::DenseMap<const clang::FunctionDecl *, VarDecl *> FunctionsAsProperties;

0 commit comments

Comments
 (0)