Clang Can Analyze Code Comments, Generate Docs
Aside from why LLVM/Clang was ported to one of the fastest super computer's in the world and using Clang to implement Microsoft's C++ AMP, another interesting session at this month's LLVM Developers' Conference in San Jose was about using Clang to analyze code comments.
By having Clang parse documentation comments, Clang could be enhanced to do additional semantic checking, ensure the code comments remain relevant to the actual code, and code completion APIs could take advantage of the documentation within the code. Ultimately, a Doxygen-like tool could be created based upon Clang for generating proper documentation out of the code itself and the associated comments. Further out, automatic comment re-factoring could be done to update names referenced within the inline code comments so that the resulting documentation is always up-to-date.
Lots of this has already been implemented within Clang and the libclang library. Dmitri Gribenko of the HPC Center at the National Technical University of Ukraine in Kyiv presented on this work. There are PDF slides available for those interested in parsing documentation comments in Clang.
What's implemented up to this point is that Clang can parse documentation comments, find semantic errors in comments, and export comments as XML. Dmitri says, "This work enables more awesome features in future!"
Parsing of documentation comments isn't done by default since some programmers don't want it plus it would slow down the build process. This process is only done if -Wdocumentation is passed to the compiler front-end.
Latest Linux Hardware Reviews
Latest Linux Articles
Latest Linux News
Latest Forum Discussions