How to remove error limit in Clang Libtooling?

1.5k views Asked by At

I made C/C++ source code modification tool using Clang Libtooling. I ran into the following error while executing my tool on test programs.

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

But I would like for the tool to ignore this limit, print all the errors, and execute AST modification as normal. Is there a way to fix this problem using Clang Libtooling?

1

There are 1 answers

0
lkarus On BEST ANSWER

Thanks to @dratenik, I solved the problem by adding an ArgumentAdjuster which passes Clang the option -ferror-limit=0.

clang::tooling::ClangTool tool(compileDb, filename);
tool.appendArgumentsAdjuster(clang::tooling::getInsertArgumentAdjuster(
    "-ferror-limit=0"));
tool.run(...);