[cfe-dev] The qualified name of a base class
Sitvanit Ruah via cfe-dev
cfe-dev at lists.llvm.org
Wed May 22 00:24:44 PDT 2019
Hello,
I have the following classes in the input to my clang analyzer checker:
namespace bases{
class base0{
int x;
....};
template <class T>
class base1{
private:
int x;
public:
void print_member(){
std::cout << x << std::endl;
}
};
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 as
follows:
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::base 0>" 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. ***
Any idea how to solve this?
Thanks,
Sitvanit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190522/ca527682/attachment.html>
More information about the cfe-dev
mailing list