Disable warnings of code when running runToolOnCode()?

Hello everyone, I’m using runToolOnCode() from clang::tooling to run some actions in C code. It would always show warnings in the C code. I wonder if the warnings could be turned off. I tried to find a way in clang doxygen but couldn’t.

I found that runToolOnCode() uses -fsyntax-only by default. So if I want to disable warnings, the only way to do so is to change the code of runToolOnCode()? Which flag should I use to not perform syntax check but still parses the source code and run tools on it?
llvm-project/clang/lib/Tooling/Tooling.cpp at 96196e25fd49e3d0ecec9550e81365ce122679cb · llvm/llvm-project (github.com)

Have you seen runToolOnCodeWithArgs()? That lets you pass command line arguments to the tool.

Thank you. I used this method and passed “–no-warnings” to the tool. Now the warnings are not shown.