Fix unaligned memory read issue exposed by ubsan
[oota-llvm.git] / include / llvm / Support / MemoryBuffer.h
index 35a7bdb004a97d6b6867ddfa777299ba29876d79..4aeca0c5b6412bcec6442c2cc75b62e1ec6cbf1e 100644 (file)
@@ -122,9 +122,10 @@ public:
   /// Open the specified file as a MemoryBuffer, or open stdin if the Filename
   /// is "-".
   static ErrorOr<std::unique_ptr<MemoryBuffer>>
-  getFileOrSTDIN(const Twine &Filename, int64_t FileSize = -1);
+  getFileOrSTDIN(const Twine &Filename, int64_t FileSize = -1,
+                 bool RequiresNullTerminator = true);
 
-  /// Map a subrange of the the specified file as a MemoryBuffer.
+  /// Map a subrange of the specified file as a MemoryBuffer.
   static ErrorOr<std::unique_ptr<MemoryBuffer>>
   getFileSlice(const Twine &Filename, uint64_t MapSize, uint64_t Offset);