summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Support/StreamingMemoryObject.h11
-rw-r--r--llvm/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bcbin0 -> 371 bytes
-rw-r--r--llvm/test/Bitcode/invalid.test5
3 files changed, 11 insertions, 5 deletions
diff --git a/llvm/include/llvm/Support/StreamingMemoryObject.h b/llvm/include/llvm/Support/StreamingMemoryObject.h
index fb63da7dbcc..9d1d607005f 100644
--- a/llvm/include/llvm/Support/StreamingMemoryObject.h
+++ b/llvm/include/llvm/Support/StreamingMemoryObject.h
@@ -29,11 +29,12 @@ public:
uint64_t readBytes(uint8_t *Buf, uint64_t Size,
uint64_t Address) const override;
const uint8_t *getPointer(uint64_t address, uint64_t size) const override {
- // This could be fixed by ensuring the bytes are fetched and making a copy,
- // requiring that the bitcode size be known, or otherwise ensuring that
- // the memory doesn't go away/get reallocated, but it's
- // not currently necessary. Users that need the pointer don't stream.
- llvm_unreachable("getPointer in streaming memory objects not allowed");
+ // FIXME: This could be fixed by ensuring the bytes are fetched and
+ // making a copy, requiring that the bitcode size be known, or
+ // otherwise ensuring that the memory doesn't go away/get reallocated,
+ // but it's not currently necessary. Users that need the pointer (any
+ // that need Blobs) don't stream.
+ report_fatal_error("getPointer in streaming memory objects not allowed");
return nullptr;
}
bool isValidAddress(uint64_t address) const override;
diff --git a/llvm/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc b/llvm/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc
new file mode 100644
index 00000000000..7e32f8b0774
--- /dev/null
+++ b/llvm/test/Bitcode/Inputs/invalid-fixme-streaming-blob.bc
Binary files differ
diff --git a/llvm/test/Bitcode/invalid.test b/llvm/test/Bitcode/invalid.test
index 7a2dbdcc1b3..f609d043df4 100644
--- a/llvm/test/Bitcode/invalid.test
+++ b/llvm/test/Bitcode/invalid.test
@@ -157,3 +157,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-function-argument-type.bc 2>
RUN: FileCheck --check-prefix=INVALID-ARGUMENT-TYPE %s
INVALID-ARGUMENT-TYPE: Invalid function argument type
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-fixme-streaming-blob.bc 2>&1 | \
+RUN: FileCheck --check-prefix=STREAMING-BLOB %s
+
+STREAMING-BLOB: getPointer in streaming memory objects not allowed
OpenPOWER on IntegriCloud