I’m working on a plugin to enforce a particular coding style. One of the rules requires that all comments follow a certain pattern. I’ve been having trouble finding a way to access all the comments in a translation unit, so that they can be checked.
Is there a way to do this with the current plugin and static analysis tools, or are those only designed to look at actual code, and not comments?
You can get the comment attached to a Decl with ASTContext::getRawCommentForDeclNoCache(), but I’m not sure if we support something as powerful as, say, iterating over every comment in the TU.
I’ve CC’d Dmitri who knows about clang’s comment-accessing capabilities (he is responsible for -Wdocumentation).
– Sean Silva
-fparse-all-comments option forces Clang to retain all comments in
ASTContext::Comments (by default it will only include comments with