From b07298eeddd95c294ee877daa64f5f3ecf92a78e Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sat, 1 Dec 2018 00:22:39 +0000 Subject: Use RequireNullTerminator=false in identify_magic. identify_magic does not need the file to be null terminated. Passing true here causes the file reading code to decide not to use mmap in some rare cases (which happen to be true 100% of the time in PDB files) which can lead to very large files failing to load. Since it was probably just an accident that we were passing true here (since it is the default function parameter), this should be strictly an improvement. llvm-svn: 348059 --- llvm/lib/BinaryFormat/Magic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/BinaryFormat/Magic.cpp') diff --git a/llvm/lib/BinaryFormat/Magic.cpp b/llvm/lib/BinaryFormat/Magic.cpp index 5a339583fca..78efa6ec87b 100644 --- a/llvm/lib/BinaryFormat/Magic.cpp +++ b/llvm/lib/BinaryFormat/Magic.cpp @@ -206,7 +206,7 @@ file_magic llvm::identify_magic(StringRef Magic) { } std::error_code llvm::identify_magic(const Twine &Path, file_magic &Result) { - auto FileOrError = MemoryBuffer::getFile(Path); + auto FileOrError = MemoryBuffer::getFile(Path, -1LL, false); if (!FileOrError) return FileOrError.getError(); -- cgit v1.2.3