[cfe-dev] Qualified name for a template base class
Sitvanit Ruah via cfe-dev
cfe-dev at lists.llvm.org
Wed May 22 23:40:59 PDT 2019
Hello,
I am trying to do class hierarchy analysis by adding a checker to clang
analyzer but when the base class is a template I do not get the base full
qualified name.
For example:
I have the following classes:
namespace bases{
class base0{
....};
template <class T>
class base1{
};
class derived : public base1<base0>{
};
}
In my code in VisitRecordDecl(CXXRecordDecl decl) where decl is the
declaration of class "derived" I iterate over the bases of derived:
for (CXXBaseSpecifier *it = decl->bases->begin(); it!=decl->bases_end();
it++){
QualType qual_type = it->getType();
std::cout << qual_type.getAsString();
}
qual_type.getAsString() gives "base1<class bases::base0>" for the base
of bases::derived. How can I get the full qualified name bases::base1<class
bases::base0>?
The same happens when the derived and base classes are defined in
different namespaces.
For example
using namespace bases;
namespace bases2{
class derived2 : public base1<base0>
}
I still get only base1<class bases::base0> instead of bases::base1<class
bases::base0>.
Note that for the template argument the full qualified name is given.
The problem happens only when the base is a template.
Thanks,
Sitvanit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190523/6852ea42/attachment.html>
More information about the cfe-dev
mailing list