MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / DemangleFunction

Method DemangleFunction

demangler/gnu3/demangle_gnu3.cpp:290–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288
289
290TypeBuilder DemangleGNU3::DemangleFunction(bool cnst, bool vltl)
291{
292 indent();
293 MyLogDebug("%s : %s\n", __FUNCTION__, m_reader.GetRaw().c_str());
294 bool old_isparam;
295 if (m_reader.Peek() == 'Y')
296 {
297 // TODO: This function is external, should we do anything with that info?
298 m_reader.Consume();
299 }
300
301 TypeBuilder retType = DemangleType();
302
303 vector<FunctionParameter> params;
304 old_isparam = m_isParameter;
305 m_isParameter = true;
306 m_functionSubstitute.push_back({});
307 int i = 0;
308 while (m_reader.Peek() != 'E')
309 {
310 TypeBuilder param = DemangleType();
311 if (param.GetClass() == VoidTypeClass)
312 continue;
313 MyLogDebug("Var_%d - %s\n", i++, param.GetString().c_str());
314 m_functionSubstitute.back().push_back(param);
315 params.push_back({"", param.Finalize(), true, Variable()});
316 }
317 m_reader.Consume();
318 m_functionSubstitute.pop_back();
319 m_isParameter = old_isparam;
320 TypeBuilder newType = TypeBuilder::FunctionType(retType.Finalize(), nullptr, params);
321 PushType(newType);
322
323 newType.SetConst(cnst);
324 newType.SetVolatile(vltl);
325
326 if (cnst || vltl)
327 PushType(newType);
328 MyLogDebug("After %s : %s\n", __FUNCTION__, m_reader.GetRaw().c_str());
329 dedent();
330 return newType;
331}
332
333
334const TypeBuilder& DemangleGNU3::DemangleTemplateSubstitution()

Callers

nothing calls this directly

Calls 11

MyLogDebugFunction · 0.85
c_strMethod · 0.80
push_backMethod · 0.80
GetClassMethod · 0.80
VariableClass · 0.50
FunctionTypeClass · 0.50
GetRawMethod · 0.45
PeekMethod · 0.45
ConsumeMethod · 0.45
GetStringMethod · 0.45
FinalizeMethod · 0.45

Tested by

no test coverage detected