[cfe-dev] Plugin argument parsing

Jan Bierbaum s3306700 at inf.tu-dresden.de
Sun Aug 1 10:09:51 PDT 2010


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.



More information about the cfe-dev mailing list