@@ -712,11 +712,13 @@ class RustFunction : public RustType {
712712public:
713713 RustFunction (const ConstString &name, uint64_t byte_size,
714714 const CompilerType &return_type,
715- const std::vector<CompilerType> &&arguments)
715+ const std::vector<CompilerType> &&arguments,
716+ const std::vector<CompilerType> &&template_arguments)
716717 : RustType(name),
717718 m_byte_size (byte_size),
718719 m_return_type(return_type),
719- m_arguments(std::move(arguments))
720+ m_arguments(std::move(arguments)),
721+ m_template_args(std::move(template_arguments))
720722 {
721723 }
722724 DISALLOW_COPY_AND_ASSIGN (RustFunction);
@@ -763,11 +765,20 @@ class RustFunction : public RustType {
763765 return result + " )" ;
764766 }
765767
768+ size_t GetNumTemplateArguments () const {
769+ return m_template_args.size ();
770+ }
771+
772+ CompilerType GetTypeTemplateArgument (size_t idx) const {
773+ return m_template_args[idx];
774+ }
775+
766776private:
767777
768778 uint64_t m_byte_size;
769779 CompilerType m_return_type;
770780 std::vector<CompilerType> m_arguments;
781+ std::vector<CompilerType> m_template_args;
771782};
772783
773784class RustTypedef : public RustType {
@@ -1921,8 +1932,10 @@ void RustASTContext::AddFieldToStruct(const CompilerType &struct_type,
19211932CompilerType
19221933RustASTContext::CreateFunctionType (const lldb_private::ConstString &name,
19231934 const CompilerType &return_type,
1924- const std::vector<CompilerType> &¶ms) {
1925- RustType *type = new RustFunction (name, m_pointer_byte_size, return_type, std::move (params));
1935+ const std::vector<CompilerType> &¶ms,
1936+ const std::vector<CompilerType> &&template_params) {
1937+ RustType *type = new RustFunction (name, m_pointer_byte_size, return_type, std::move (params),
1938+ std::move (template_params));
19261939 return CacheType (type);
19271940}
19281941
@@ -2168,6 +2181,8 @@ CompilerType RustASTContext::GetTypeTemplateArgument(lldb::opaque_compiler_type_
21682181 RustType *t = static_cast <RustType *>(type);
21692182 if (RustAggregateBase *a = t->AsAggregate ()) {
21702183 return a->GetTypeTemplateArgument (idx);
2184+ } else if (RustFunction *f = t->AsFunction ()) {
2185+ return f->GetTypeTemplateArgument (idx);
21712186 }
21722187 }
21732188 return CompilerType ();
@@ -2178,6 +2193,8 @@ size_t RustASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type
21782193 RustType *t = static_cast <RustType *>(type);
21792194 if (RustAggregateBase *a = t->AsAggregate ()) {
21802195 return a->GetNumTemplateArguments ();
2196+ } else if (RustFunction *f = t->AsFunction ()) {
2197+ return f->GetNumTemplateArguments ();
21812198 }
21822199 }
21832200 return 0 ;
0 commit comments