Retaining comments in the AST

Hi,

I am trying to extract comments from declarations using recursive ast visitor. Following is the stub of my code:

 class FindNamedClassVisitor : public RecursiveASTVisitor<FindNamedClassVisitor>{
   public: explicit FindNamedClassVisitor(ASTContext *Context) : Context(Context) {}
   public: bool VisitDecl(Decl* decl){
      ASTContext& ctx = decl->getASTContext();
      SourceManager& sm = ctx.getSourceManager();
      RawComment* rc = ctx.getRawCommentForDeclNoCache(decl);
      if(rc)
      {
          std::string brief = rc->getBriefText(ctx);
          std::cout <<"parsed comment is"<<brief<<std::endl;
      }
      return true;
   }

I am running it with option -f-parse-all-comments but I am not able retrieve any comments from my test file. Btw, I even can’t see the comment appear when I use lang-check -ast-dump filename.cpp --extra-arg=-fparse-all-comments. Can anyone please what’s the correct way to retain comments while generating ast using clang.

Thanks
Nikita