Get variable declaration type as String sometimes gives me wrong types.

Hello again,

I have implmented an AST Visitor using clang. In my visitor exists the following function.

virtual bool VisitVarDecl(VarDecl *var)
{
numVariables++;
string varName = var->getQualifiedNameAsString();
string varType = var->getType().getAsString();
cout << "VisitVarDecl: " << varName << " of type " << varType << “\n”;
APIs << varType << ", ";
return true;
}

Now the problem is that whenever a variable declaration exists in my code the visitor detects it but sometimes returns me the wrong type.
for Example if the type is size_t it will return int. if the size is char32_t it will again return int.
I just want it to return whatever the type is even if is imaginary for example
asdasd x;

Thank you,
Andreas Georgiou