[PATCH] D26981: Limit maximum number of errors to 1000.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 10:47:14 PST 2016


ruiu added a comment.

I'll add a test once we get an agreement on what we should do.



================
Comment at: ELF/Error.cpp:44
 void elf::error(const Twine &Msg) {
-  *ErrorOS << Argv0 << ": error: " << Msg << "\n";
+  if (ErrorLimit == 0 || ErrorCount <= ErrorLimit)
+    *ErrorOS << Argv0 << ": error: " << Msg << "\n";
----------------
filcab wrote:
> Nit: The `<=` condition and `ErrorCount++` below this check make lld emit N+1 errors.
Will fix.


================
Comment at: ELF/Error.cpp:46
+    *ErrorOS << Argv0 << ": error: " << Msg << "\n";
+  else if (Config->ExitEarly)
+    exitLld(1);
----------------
filcab wrote:
> I don't think this should really be tied to `--full-shutdown`. I see those features as orthogonal.
It correlates to `CanExitEarly` argument given to lld::elf::link. If it's true, we can't exit. Since --full-shutdown is for tests, I think using `Config->ExitEarly` is okay.


================
Comment at: ELF/Error.cpp:47
+  else if (Config->ExitEarly)
+    exitLld(1);
+
----------------
filcab wrote:
> You probably want to tell the user why lld exited. Something like "Too many errors emitted, halting link" should do it.
> (No need to go overboard with messages like "go fix your program" like valgrind had :-) )
Agreed.


https://reviews.llvm.org/D26981





More information about the llvm-commits mailing list