[cfe-dev] Plugin clang
brahim brahim
brahimalekhine at gmail.com
Wed Feb 18 02:10:03 PST 2015
Hello,
I am trying to implement a plugin for clang that prints all c++ classes and
they are base classes.
I can't find in Doxygen how to access the base class's name.
Can someone help finish this piece of code(see below)?
Thank
Brahim
class ClassFinderConsumer : public ASTConsumer {
public:
virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
const Decl *D = *i;
if (const CXXRecordDecl *ND = dyn_cast<CXXRecordDecl>(D)) {
llvm::errs() << "Class: " << ND->getNameAsString() << "\nBase(s): ";
for (const auto& ItBase : ND->bases()) {
const QualType& T = ItBase.getType();
// Then...
//llvm::errs() << ItBase.getType() << " ";
}
llvm::errs() << "\n";
}
}
return true;
}
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150218/44c2c441/attachment.html>
More information about the cfe-dev
mailing list