CompilerInstance and setting compiler options


I am developing a static analyzer using clang. I setup a CompilerInstance,
ASTConsumer etc. as copied from a number of examples. I would like to know
how to set compiler options. In particular I would like to suppress
'warning: expression result unused' (-Wunused-value)



I think that you can use clang::createInvocationFromCommandLine to parse your compiler arguments into an instance of CompilerInvocation. Then you can call CompilerInstance::setInvocation to update the invocation in your compiler instance.

I hope that helps,