title: How to extract comments and match to declaration with RecursiveASTVisitor in libclang c++?
body: <p>I am writing a utility which is supposed to parse C++ (and C) header files, extract the structs, enums, fields etc. and generate code in other languages based on the extracted information. I decided to use libclang for this.</p>
  
  <p>I'm using a <code>RecursiveASTVisitor</code> and it seems I'm able to extract all the information I need, except for comments.</p>
  
  <p>I want to have the comment which appears right above every declaration (field, struct, class, enum) read, and add its text when I generate the code in other languages.</p>
  
  <p>The problem is that all the samples I saw which use comments use <code>CxCursor</code> and the C interface for clang, and I have no idea how to get the <code>CxCursor</code> in my context.</p>
  
  <p>So - how can I extract comments while still using <code>RecursiveASTVisitor</code>?</p>