Problem with getting function templated type arguments
mVento3 opened this issue · 2 comments
mVento3 commented
I have some weird problem with getting function arguments type. For some reason instead of getting templated type I am getting int. I have found a workaround using typedefs but it is a bit annoying.
Here an example:
void GenerateCustom(std::ofstream& _hFile, std::ofstream& _sFile, std::vector<std::pair<uint32_t, std::vector<std::string>>>& _aGenerated);
Instead of getting std::vector<...>&
I am getting int reference (the same is with std::filesystem::path).
Here is the code to get the arguments type:
//const cppast::cpp_member_function& _entity;
//compile_config _config;
//_config.fast_preprocessing(true);
//_config.set_flags(cppast::cpp_standard::cpp_latest);
for(const auto& _arg : _entity.parameters())
{
__ast_entity_argument _eArg;
_eArg.m_sName = _arg.name();
_eArg.m_sType = to_string(_arg.type());
_pScope->m_aArguments.push_back(_eArg);
}
Is that even supported? All I need is a string of this type.
- cppast version: latest
- parser: libclang_parser
- clang version: 15.0.6
mVento3 commented
The problems was I did not define some of my needed definitions in config which resulted in parsing error, and the default type in libclang is int, issue solved.
benkoska commented
I ran into the same problem. Would you mind sharing exactly which config change(s)/definitions fixed the problem?