@@ -712,11 +712,13 @@ class RustFunction : public RustType {
712
712
public:
713
713
RustFunction (const ConstString &name, uint64_t byte_size,
714
714
const CompilerType &return_type,
715
- const std::vector<CompilerType> &&arguments)
715
+ const std::vector<CompilerType> &&arguments,
716
+ const std::vector<CompilerType> &&template_arguments)
716
717
: RustType(name),
717
718
m_byte_size (byte_size),
718
719
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))
720
722
{
721
723
}
722
724
DISALLOW_COPY_AND_ASSIGN (RustFunction);
@@ -763,11 +765,20 @@ class RustFunction : public RustType {
763
765
return result + " )" ;
764
766
}
765
767
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
+
766
776
private:
767
777
768
778
uint64_t m_byte_size;
769
779
CompilerType m_return_type;
770
780
std::vector<CompilerType> m_arguments;
781
+ std::vector<CompilerType> m_template_args;
771
782
};
772
783
773
784
class RustTypedef : public RustType {
@@ -1921,8 +1932,10 @@ void RustASTContext::AddFieldToStruct(const CompilerType &struct_type,
1921
1932
CompilerType
1922
1933
RustASTContext::CreateFunctionType (const lldb_private::ConstString &name,
1923
1934
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));
1926
1939
return CacheType (type);
1927
1940
}
1928
1941
@@ -2168,6 +2181,8 @@ CompilerType RustASTContext::GetTypeTemplateArgument(lldb::opaque_compiler_type_
2168
2181
RustType *t = static_cast <RustType *>(type);
2169
2182
if (RustAggregateBase *a = t->AsAggregate ()) {
2170
2183
return a->GetTypeTemplateArgument (idx);
2184
+ } else if (RustFunction *f = t->AsFunction ()) {
2185
+ return f->GetTypeTemplateArgument (idx);
2171
2186
}
2172
2187
}
2173
2188
return CompilerType ();
@@ -2178,6 +2193,8 @@ size_t RustASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type
2178
2193
RustType *t = static_cast <RustType *>(type);
2179
2194
if (RustAggregateBase *a = t->AsAggregate ()) {
2180
2195
return a->GetNumTemplateArguments ();
2196
+ } else if (RustFunction *f = t->AsFunction ()) {
2197
+ return f->GetNumTemplateArguments ();
2181
2198
}
2182
2199
}
2183
2200
return 0 ;
0 commit comments