[PATCH] llvm-cov: Replaced asserts with proper error handling
Justin Bogner
mail at justinbogner.com
Wed Oct 30 23:01:33 PDT 2013
Yuchen Wu <yuchenericwu at hotmail.com> writes:
> Replaced asserts with proper error handling.
...
> @@ -155,7 +155,10 @@ public:
> uint32_t readInt() {
> uint32_t Result;
> StringRef Str = Buffer->getBuffer().slice(Cursor, Cursor+4);
> - assert (Str.empty() == false && "Unexpected memory buffer end!");
> + if (Str.empty()) {
> + errs() << "Unexpected memory buffer end.\n";
> + exit(1);
> + }
> Cursor += 4;
> Result = *(const uint32_t *)(Str.data());
> return Result;
It's generally not appropriate to exit(1) in LLVM. Can we do something
smarter?
More information about the llvm-commits
mailing list