aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2024-06-12 13:14:26 -0700
committerGitHub <noreply@github.com>2024-06-12 13:14:26 -0700
commit682d461d5a231cee54d65910e6341769419a67d7 (patch)
tree1441fb2956b5f3c2f355d442c4de0508f5259a35 /clang/lib/Basic/FileManager.cpp
parent294f3ce5dde916c358d8f672b4a1c706c0387154 (diff)
downloadllvm-682d461d5a231cee54d65910e6341769419a67d7.zip
llvm-682d461d5a231cee54d65910e6341769419a67d7.tar.gz
llvm-682d461d5a231cee54d65910e6341769419a67d7.tar.bz2
Revert "✨ [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy)" (#95299)
Reverts llvm/llvm-project#68620 Introduce or expose a memory leak and UB, see llvm/llvm-project#68620
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r--clang/lib/Basic/FileManager.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 4509cee..1dc51de 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -530,18 +530,13 @@ void FileManager::fillRealPathName(FileEntry *UFE, llvm::StringRef FileName) {
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
FileManager::getBufferForFile(FileEntryRef FE, bool isVolatile,
- bool RequiresNullTerminator,
- std::optional<int64_t> MaybeLimit) {
+ bool RequiresNullTerminator) {
const FileEntry *Entry = &FE.getFileEntry();
// If the content is living on the file entry, return a reference to it.
if (Entry->Content)
return llvm::MemoryBuffer::getMemBuffer(Entry->Content->getMemBufferRef());
uint64_t FileSize = Entry->getSize();
-
- if (MaybeLimit)
- FileSize = *MaybeLimit;
-
// If there's a high enough chance that the file have changed since we
// got its size, force a stat before opening it.
if (isVolatile || Entry->isNamedPipe())