Skip to content

Commit d35896e

Browse files
committed
[interop] do not warn about a template with too many specializations that can't be imported
1 parent 893ba60 commit d35896e

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
@@ -2889,12 +2889,12 @@ namespace {
28892889
if (size_t(
28902890
llvm::size(decl->getSpecializedTemplate()->specializations())) >
28912891
specializationLimit) {
2892-
std::string name;
2893-
llvm::raw_string_ostream os(name);
2894-
decl->printQualifiedName(os);
2895-
// Emit a warning if we haven't warned about this decl yet.
2896-
if (Impl.tooDeepTemplateSpecializations.insert(name).second)
2897-
Impl.diagnose({}, diag::too_many_class_template_instantiations, name);
2892+
// Note: it would be nice to import a dummy unavailable struct,
2893+
// but we would then need to instantiate the template here,
2894+
// as we cannot import a struct without a definition. That would
2895+
// defeat the purpose. Also, we can't make the dummy
2896+
// struct simply unavailable, as that still makes the
2897+
// typelias that references it available.
28982898
return nullptr;
28992899
}
29002900

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)