[llvm] [MC][AsmParser]: Don't use SourceMgr::AddIncludeFile when opening .incbin files (PR #194254)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 07:41:49 PDT 2026


================
@@ -246,6 +261,28 @@ RealFile::getBuffer(const Twine &Name, int64_t FileSize,
                                    IsVolatile);
 }
 
+ErrorOr<std::unique_ptr<MemoryBuffer>>
+RealFile::getSliceBuffer(const Twine &Name, int64_t Offset, int64_t Count,
+                         bool IsVolatile) {
+  auto BypassSandbox = sys::sandbox::scopedDisable();
+  assert(Offset >= 0 && "Negative Offset");
+
+  if (Count == -1) {
+    uint64_t FileSize;
+    std::error_code Error = sys::fs::file_size(Name, FileSize);
----------------
SergeantCooper wrote:

I did this because of an assert in `MemoryBuffer::getOpenFileSlice` -> `assert(MapSize != uint64_t(-1));` which is called at the last in this function

https://github.com/llvm/llvm-project/pull/194254


More information about the llvm-commits mailing list