[cfe-dev] A documentation tool based on clang AST.
Juan Jose Lopez Villarejo
jj.lopezvillarejo at cern.ch
Tue Sep 10 01:34:08 PDT 2013
Dear colleagues,
We are open to scientific collaborations or to engage a (paid) consultant for a clang project, in the wider context of the VINCIA collaboration for LHC Physics (vincia.hepforge.org).
Basically, we want to extract special comments from the clang AST together with their context (where are they?). That information will be used to generate a high-level (human-like) flowchart of our code. It is a similar spirit to Doxygen, but here we want activity diagrams as the outcome.
The most complete visual presentation of the project is here:
https://dl.dropboxusercontent.com/u/36372825/current/index.html
I can also quote a specific example, which illustrates the kind of difficulties that we face:
========
[file test.cpp]
int main () {
/// [condition A]
if(conditionStatement) {
/// action 1
code
/// action 2
code
}
/// [condition B]
else if(conditionStatement) {
/// action 3
code
}
/// [condition C]
else{
code
}
return 0;
}
For this test source file, we would like to get the attached diagram [IFstatement.jpg]
------
Consider a (doxygen-like) comment such as "///action 2".
We have to associate somehow this comment with the compound statement inside the if statement in the AST. The problem is that clang won't store in general that information. Only some comments before certain declarations / statements get properly stored in the AST.
We can use a method such as RawCommentList to retrieve all the comments in a Translation Unit. Then, we would have to play with the source positions in the SourceManager to place these comments by hand inside the AST.
Do you have any idea how to do this in practice?
=========
I'm looking forward to hearing your thoughts. Best regards,
Juan J. Lopez-Villarejo
on behalf of the VINCIA Collaboration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130910/b7860686/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IFstatement.jpg
Type: image/jpeg
Size: 24491 bytes
Desc: IFstatement.jpg
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130910/b7860686/attachment.jpg>
More information about the cfe-dev
mailing list