diff options
author | JF Bastien <jfbastien@apple.com> | 2019-06-26 19:50:12 +0000 |
---|---|---|
committer | JF Bastien <jfbastien@apple.com> | 2019-06-26 19:50:12 +0000 |
commit | 0e828958264734e60115ba2482437008c822d7db (patch) | |
tree | 3fc2aa5876f36d46ae328df9b7a5ee7dfa781894 /llvm/test/Bitcode | |
parent | afa58b6ba19a54e6fd41ab3994e114f0f6bcb239 (diff) | |
download | bcm5719-llvm-0e828958264734e60115ba2482437008c822d7db.tar.gz bcm5719-llvm-0e828958264734e60115ba2482437008c822d7db.zip |
BitStream reader: propagate errors
The bitstream reader handles errors poorly. This has two effects:
* Bugs in file handling (especially modules) manifest as an "unexpected end of
file" crash
* Users of clang as a library end up aborting because the code unconditionally
calls `report_fatal_error`
The bitstream reader should be more resilient and return Expected / Error as
soon as an error is encountered, not way late like it does now. This patch
starts doing so and adopting the error handling where I think it makes sense.
There's plenty more to do: this patch propagates errors to be minimally useful,
and follow-ups will propagate them further and improve diagnostics.
https://bugs.llvm.org/show_bug.cgi?id=42311
<rdar://problem/33159405>
Differential Revision: https://reviews.llvm.org/D63518
llvm-svn: 364464
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r-- | llvm/test/Bitcode/invalid.test | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/test/Bitcode/invalid.test b/llvm/test/Bitcode/invalid.test index bde5883d221..15e978076d1 100644 --- a/llvm/test/Bitcode/invalid.test +++ b/llvm/test/Bitcode/invalid.test @@ -29,13 +29,13 @@ RUN: FileCheck --check-prefix=MISMATCHED-EXPLICIT-INVOKE %s RUN: not llvm-dis -disable-output %p/Inputs/invalid-invoke-non-function-explicit-type.bc 2>&1 | \ RUN: FileCheck --check-prefix=NON-FUNCTION-EXPLICIT-INVOKE %s -INVALID-EMPTY: Invalid bitcode signature +INVALID-EMPTY: error: file too small to contain bitcode header INVALID-ENCODING: Invalid encoding -BAD-ABBREV: Malformed block -UNEXPECTED-EOF: Malformed block -BAD-ABBREV-NUMBER: Malformed block +BAD-ABBREV: error: can't skip to bit 25870861920 from 96 +UNEXPECTED-EOF: error: can't skip to bit 25870861920 from 96 +BAD-ABBREV-NUMBER: error: can't skip to bit 25870861920 from 96 BAD-TYPE-TABLE-FORWARD-REF: Invalid TYPE table: Only named structs can be forward referenced -BAD-BITWIDTH: Malformed block +BAD-BITWIDTH: error: can't skip to bit 3616 from 96 BAD-ALIGN: Invalid alignment value MISMATCHED-EXPLICIT-GEP: Explicit gep type does not match pointee type of pointer operand MISMATCHED-EXPLICIT-LOAD: Explicit load/store type does not match pointee type of pointer operand @@ -154,7 +154,7 @@ EXTRACT-0-IDXS: EXTRACTVAL: Invalid instruction with 0 indices RUN: not llvm-dis -disable-output %p/Inputs/invalid-load-ptr-type.bc 2>&1 | \ RUN: FileCheck --check-prefix=BAD-LOAD-PTR-TYPE %s -BAD-LOAD-PTR-TYPE: Malformed block +BAD-LOAD-PTR-TYPE: error: can't skip to bit 3616 from 96 RUN: not llvm-dis -disable-output %p/Inputs/invalid-inserted-value-type-mismatch.bc 2>&1 | \ RUN: FileCheck --check-prefix=INSERT-TYPE-MISMATCH %s @@ -164,7 +164,7 @@ INSERT-TYPE-MISMATCH: Inserted value type doesn't match aggregate type RUN: not llvm-dis -disable-output %p/Inputs/invalid-code-len-width.bc 2>&1 | \ RUN: FileCheck --check-prefix=INVALID-CODELENWIDTH %s -INVALID-CODELENWIDTH: Malformed block +INVALID-CODELENWIDTH: error: can't skip to bit 3616 from 96 RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-argument-type.bc 2>&1 | \ RUN: FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s |