[cfe-dev] Using libClang for parsing Source and Comments

barbara via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 23 10:23:52 PST 2016


We have not found a tutorial or any documentation addressing our 
requirement to use libClang for parsing C++ source and full comments.  
We are currently using libClang 3.6 for testing however moving to 3.7 is 
possible although we would rather wait for 3.8.

At the present time we have code to walk the AST and obtain cursors and 
tokens for a sample C++ header. The following are the initial problems 
we have encountered.

1)    Locate C++ standard headers

On Debian we did not have to pass any parameters to libClang for it to 
locate the C++ standard header files.

On Windows, I had to pass six include lines which referenced GCC std 
header files. This works but it will be cumbersome for our users. We 
talked with a few people at the last llvm meeting  it was mentioned 
there might be some enhancements for detecting the system headers.

Do anyone have ideas or suggestion about this?


2)    We need to retrieve all the comments and using "cursors" this has 
not worked.  We can easily generate a list of the tokens and walking 
these appear to show the comments, however this feels very awkward and 
slow.  We understand the basic idea of cursors and tokens. We are not 
sure about the pros and cons of each approach.


3)  Is the -Wdocumentation flag passed to clang when building. Or is 
this flag supposed to be passed to libClang?  Will this provide us with 
more of the user comments?  It appeared to to have no effect.


Our thanks for any and all guidance,

Barbara  Geller
Co-Founder of DoxyPress project


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus




More information about the cfe-dev mailing list