[cfe-dev] About Clang Static Analyzer

Aditya Kale kaleaditya92 at gmail.com
Sun Jan 25 00:53:32 PST 2015


Hi,

I want to visit CXXRecordDecl in my checker. But I am getting error. But it
works for FunctionDecl or VaeDecl.

Following works:

class MyRuleChecker : public clang::ento::Checker <
         clang::ento::check::ASTDecl<clang::FunctionDecl> > {
  public:

  void   checkASTDecl(const FunctionDecl *D,
                                     AnalysisManager &Mgr,
                                     BugReporter &BR) const
   {
      return;
   }

  };

But following does not work:

class MyRuleChecker : public clang::ento::Checker <
         clang::ento::check::ASTDecl<CXXRecordDecl> > {
  public:

    checkASTDecl(const CXXRecordDecl *D,
                                     AnalysisManager &Mgr,
                                     BugReporter &BR) const
   {
      //return;
   }

  };

It gives error:

MyRuleChecker.cpp:116:38:   required from here
/home/anand/Desktop/static1/llvm/include/llvm/Support/Casting.h:56:28:
error: incomplete type 'clang::CXXRecordDecl' used in nested name specifier
     return To::classof(&Val);
                            ^
/home/anand/Desktop/static1/llvm/include/llvm/Support/Casting.h: In static
member function 'static bool llvm::isa_impl<To, From, Enabler>::doit(const
From&) [with To = clang::CXXRecordDecl; From = clang::Decl; Enabler =
void]':
/home/anand/Desktop/static1/llvm/include/llvm/Support/Casting.h:57:3:
warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^
Thanks & Regars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150125/6c200988/attachment.html>


More information about the cfe-dev mailing list