I am trying to extract all the function signatures, essentially parameters complete type, with namespace from a c/cpp source. The objective is to create a file in which I can decleare the same type variable, without opening the namespace in which they are and to be able to compile that file successfully.
I've objects of Type* from ParamVarDecl* using RecursiveASTVisitor, in very simple cases I can get the type as string, which is fine but in this case-
//signature.cpp
//#includes...
using namespace std;
void func(size_t pin) {
//some def.
}
dumping Type* obtained from, paramDecl->getType().getTypePtrOrNull() I get the AST as,
ElaboratedType 0x1c06b378df0 'size_t' sugar
`-TypedefType 0x1c06b378dc0 'size_t' sugar
|-Typedef 0x1c06b378b28 'size_t'
`-BuiltinType 0x1c0698845e0 'unsigned long long'
In this AST there is no info of std::, How do I get this info?
I can extract 'unsigned long long' and use that, but I am specifically looking for a way to get the namspaces in such cases.
Many thanks.
Thanks for valuable comments. I can use size_t instead of std::size_t to decleare it in another file, since both size_t and std::size_t are typedefs in C++.