Merge pull request #371 from slavapestov/function-type-dead-code
[Swift] GetNumTemplateArguments() always returns 0 for function types
diff --git a/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp b/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp
index 1684fac..901f36a 100644
--- a/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp
+++ b/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp
@@ -333,80 +333,6 @@
} while (0);
}
}
-
- do {
- ConstString function_name =
- sym_ctx.GetFunctionName(Mangled::ePreferMangled);
-
- if (function_name.IsEmpty())
- break;
-
- if (log)
- log->Printf(" [SUE::SC] Function name: %s", function_name.AsCString());
-
- Status get_type_error;
- SwiftASTContext *ast_context = llvm::dyn_cast_or_null<SwiftASTContext>(
- sym_ctx.module_sp->GetTypeSystemForLanguage(
- lldb::eLanguageTypeSwift));
- if (!ast_context || ast_context->HasFatalErrors())
- break;
-
- CompilerType function_type = ast_context->GetTypeFromMangledTypename(
- function_name.AsCString(), get_type_error);
-
- if (get_type_error.Fail() || !function_type.IsValid())
- break;
-
- if (log && function_type.GetNumTemplateArguments())
- log->Printf(" [SUE::SC] Function generic arguments:");
-
- for (size_t ai = 0, ae = function_type.GetNumTemplateArguments();
- ai != ae; ++ai) {
- lldb::TemplateArgumentKind template_arg_kind;
-
- CompilerType template_arg_type =
- function_type.GetGenericArgumentType(ai);
- ConstString template_arg_name = template_arg_type.GetTypeName();
-
- if (log)
- log->Printf(" [SUE::SC] Argument name: %s",
- template_arg_name.AsCString());
-
- CompilerType concrete_type =
- exe_ctx.GetProcessRef().GetSwiftLanguageRuntime()->GetConcreteType(
- frame, template_arg_name);
-
- lldbassert(concrete_type.IsValid());
-
- if (!concrete_type.IsValid()) {
- if (log)
- log->Printf(
- " [SUE::SC] Concrete type of generic parameter is invalid");
-
- continue;
- }
-
- if (log)
- log->Printf(" [SUE::SC] Argument type: %s",
- concrete_type.GetTypeName().AsCString());
-
- const char *name = template_arg_name.AsCString();
-
- bool found = false;
-
- for (const SwiftGenericInfo::Binding &binding :
- m_swift_generic_info.class_bindings) {
- if (binding.name == name) {
- found = true;
- break;
- }
- }
-
- if (!found)
- m_swift_generic_info.function_bindings.push_back(
- {name, concrete_type});
- }
- } while (0);
}
}