[cfe-dev] Plugin argument parsing

Daniel Dunbar daniel at zuster.org
Mon Aug 2 08:32:19 PDT 2010


Hi Jan,

I changed the API to pass in the CompilerInstance to ParseArgs, you
can use that to report diagnostics. If you want to abort execution,
you can return false from the ParseArgs function. See
http://llvm.org/viewvc/llvm-project?view=rev&revision=110039, which
includes an update to the PrintFunctionNames example.

Cheers,
 - Daniel

On Sun, Aug 1, 2010 at 10:09 AM, Jan Bierbaum
<s3306700 at inf.tu-dresden.de> wrote:
> Hello!
>
> Is there a way to access Clang's Diagnostic from inside the ParseArgs
> function of a plugin? I tried to grab it via the CompilerInstance but at
> that time getCompilerInstance fails since the instance isn't set yet.
>
> It would be good to get errors/warnings during the argument parsing out
> through Clang's Diagnostic so they count in the total.
>
> Another issue: How do I terminate Clang once a fatal error occurs during
> the parsing, e.g. some essential information is missing. Returning
> 'false' doesn't do the trick. In fact the return value is just dropped
> by Clang. So I just do an 'exit(1)' which works fine. Are there any
> problems this can cause, like inconsistent state somewhere?
>
>
> Regards, Jan.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list