1

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?

lkarus
  • 36
  • 5
  • You need to pass clang the option `-ferror-limit=0`. Possibly by invoking `CommonOptionsParser` with suitable arguments. –  Oct 06 '20 at 12:11

1 Answers1

0

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(...);
lkarus
  • 36
  • 5