File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,22 @@ class languaget:public messaget
86
86
const irep_idt &function_id, symbol_table_baset &symbol_table)
87
87
{ }
88
88
89
+ // / Can this languaget instance provide a body for `function_id`, which no
90
+ // / languaget instance has claimed to be able to provide?
91
+ virtual bool can_convert_fallback_method (const irep_idt &function_id) const
92
+ {
93
+ return false ;
94
+ }
95
+
96
+ // / Populate the body of `function_id`, which no languaget instance has
97
+ // / claimed to be able to provide.
98
+ virtual bool convert_fallback_method (
99
+ const irep_idt &function_id, symbol_table_baset &symbol_table)
100
+ {
101
+ PRECONDITION (can_convert_fallback_method (function_id));
102
+ return false ;
103
+ }
104
+
89
105
// / Final adjustments, e.g. initializing stub functions and globals that
90
106
// / were discovered during function loading
91
107
virtual bool final (symbol_table_baset &symbol_table);
Original file line number Diff line number Diff line change @@ -72,6 +72,9 @@ class language_filest:public messaget
72
72
typedef std::map<irep_idt, language_filet *> lazy_method_mapt;
73
73
lazy_method_mapt lazy_method_map;
74
74
75
+ typedef std::vector<language_filet *> fallback_method_providerst;
76
+ fallback_method_providerst fallback_method_providers;
77
+
75
78
public:
76
79
language_filet &add_file (const std::string &filename)
77
80
{
@@ -126,11 +129,29 @@ class language_filest:public messaget
126
129
lazy_method_mapt::iterator it=lazy_method_map.find (id);
127
130
if (it!=lazy_method_map.end ())
128
131
it->second ->convert_lazy_method (id, symbol_table);
132
+
133
+ for (const auto &file : file_map)
134
+ {
135
+ if (file.second .language ->can_convert_fallback_method (id) &&
136
+ file.second .language ->convert_fallback_method (id, symbol_table))
137
+ {
138
+ return ;
139
+ }
140
+ }
129
141
}
130
142
131
143
bool can_convert_lazy_method (const irep_idt &id) const
132
144
{
133
- return lazy_method_map.count (id) != 0 ;
145
+ if (lazy_method_map.count (id) != 0 )
146
+ return true ;
147
+
148
+ for (const auto &file : file_map)
149
+ {
150
+ if (file.second .language ->can_convert_fallback_method (id))
151
+ return true ;
152
+ }
153
+
154
+ return false ;
134
155
}
135
156
136
157
void clear ()
You can’t perform that action at this time.
0 commit comments