[cfe-dev] Parsing All Comments

Chengnian Sun via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 16 01:29:31 PDT 2015


This is great. I can simply use the command line option. Thank you so much.


On Fri, Oct 16, 2015 at 1:26 AM, James Dennett <james.dennett at gmail.com>
wrote:

> On Fri, Oct 16, 2015 at 1:16 AM, Chengnian Sun <chengniansun at gmail.com>
> wrote:
>
>> Thank you for your reply. The comment is very simple. Each function
>> definition has a preceding comment, listing all the global variables used
>> in the function definition. I need to parse this comment to get the
>> variable list.
>>
>> Yes, I actually found another old post mentioning CommentOptions::ParseAllComments.
>> However I am new to LLVM/Clang, and I found out it was just a structure
>> defined in CommentOptions.h if I am not wrong.
>>
>>
> CommentOptions is indeed just a class, and ParseAllComments a field in
> it.  It's normally set by this code from
> lib/Frontend/CompilerInvocation.cpp:
>
> static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args) {
>   Opts.BlockCommandNames =
> Args.getAllArgValues(OPT_fcomment_block_commands);
>   Opts.ParseAllComments = Args.hasArg(OPT_fparse_all_comments);
> }
>
> i.e., you can set it using a command line argument -fparse-all-comments if
> that's how you're configuring your tool.
>
> -- James
>
>


-- 
Best Regards.

Chengnian SUN.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151016/40df208c/attachment.html>


More information about the cfe-dev mailing list