mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[cxx-interop] Fix unavailable generics triggering compilation error
In some cases, the reverse interop generated both a forward declaration and a definition with unavailable attribute in the C++ header. Unfortunately, the kinds of these symbol did not match. The forward declaration was templated while the definition was not. The forward declaration has the correct kind, so this patch extends the printing of unavailable definitions to include the generic arguments. rdar://119835933
This commit is contained in:
@@ -874,6 +874,11 @@ public:
|
||||
// Emit an unavailable stub for a Swift type.
|
||||
if (auto *nmtd = dyn_cast<NominalTypeDecl>(vd)) {
|
||||
auto representation = cxx_translation::getDeclRepresentation(vd);
|
||||
if (nmtd->isGeneric()) {
|
||||
auto genericSignature =
|
||||
nmtd->getGenericSignature().getCanonicalSignature();
|
||||
ClangSyntaxPrinter(os).printGenericSignature(genericSignature);
|
||||
}
|
||||
os << "class ";
|
||||
ClangSyntaxPrinter(os).printBaseName(vd);
|
||||
os << " { } SWIFT_UNAVAILABLE_MSG(\"";
|
||||
|
||||
Reference in New Issue
Block a user