[llvm-dev] Get variable declaration type as String sometimes gives me wrong types.

Andreas Georgiou via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 25 09:44:14 PDT 2016


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 exampleasdasd x;
Thank you, Andreas Georgiou 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160625/607378bd/attachment.html>


More information about the llvm-dev mailing list