In one of my checker, i am using FunctionDecl class to get the function declaration. Now i want to get the name of the function for which i enter into the checkASTDecl method. As we know that in checkASTDecl() we get pointer of class FunctionDecl. So, can any one help me with way to get the name of function for which i entered into checkASTDecl.
Here is the sample code i have written:
namespace {
class FuncPrototypeChecker : public Checker<check::ASTDecl<FunctioeDecl> > {
mutable OwningPtr<BugType> TernaryOperatorBug;
public:
void checkASTDecl(const FunctionDecl *D,
AnalysisManager &mgr, BugReporter &BR) const;
};
}
void FuncPrototypeChecker::checkASTDecl(const FunctionDecl *D,
AnalysisManager &mgr,
BugReporter &BR) const {
/* Get the name of the function from FunctionDecl *D */
}
I want to get the name of the function for which i entered the method FuncPrototypeChecker::checkASTDecl(). Please help me with the way i can achieve it. Thanks in advance.