[cfe-dev] Get "full" type name from a Decl

Samana cazamana at gmail.com
Sun Dec 1 12:34:06 PST 2013


Hello,I am using Clang to parse C++ header files and generate new code. I'm
trying to get the "Full" type name from a given Decl. For example:/namespace
A{    using namespace std;    class Foo    {        vector m_StrVec;   
};}/When I got the FieldDecl* of member m_StrVec, I tried:///Prints
"vector"fieldDecl->getType().getUnqualifiedType().getAsString(); 
/and///Prints "std::__1::vector, class std::__1::vector<int, class
std::__1::allocator< ...
"fieldDecl->getType().getUnqualifiedType().getCanonicalType().getAsString(); 
/The question is, I am generating code that's expected to be able to compile
with other compilers and stl implementations, so I would need a type name
like:/"std::vector"/which just include the namespace names from the using
directives. Any ideas? :)Cheers!



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Get-full-type-name-from-a-Decl-tp4036371.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list