[Mlir-commits] [mlir] 7c800a4 - [mlir] Relax requirement on memory buffer creation.

Jacques Pienaar llvmlistbot at llvm.org
Wed Aug 30 15:30:01 PDT 2023


Author: Jacques Pienaar
Date: 2023-08-30T15:29:53-07:00
New Revision: 7c800a41b04304719f98af376e488962fc3725da

URL: https://github.com/llvm/llvm-project/commit/7c800a41b04304719f98af376e488962fc3725da
DIFF: https://github.com/llvm/llvm-project/commit/7c800a41b04304719f98af376e488962fc3725da.diff

LOG: [mlir] Relax requirement on memory buffer creation.

parseSourceString does not require null-terminated string, hence
requirement on memory buffer can be relaxed.

Differential Revision: https://reviews.llvm.org/D159214

Added: 
    

Modified: 
    mlir/lib/Parser/Parser.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp
index ef028f9978b74b..e9b5e9269b78c6 100644
--- a/mlir/lib/Parser/Parser.cpp
+++ b/mlir/lib/Parser/Parser.cpp
@@ -91,7 +91,9 @@ LogicalResult mlir::parseSourceString(llvm::StringRef sourceStr, Block *block,
                                       const ParserConfig &config,
                                       StringRef sourceName,
                                       LocationAttr *sourceFileLoc) {
-  auto memBuffer = llvm::MemoryBuffer::getMemBuffer(sourceStr, sourceName);
+  auto memBuffer =
+      llvm::MemoryBuffer::getMemBuffer(sourceStr, sourceName,
+                                       /*RequiresNullTerminator=*/false);
   if (!memBuffer)
     return failure();
 


        


More information about the Mlir-commits mailing list