Skip to content

Commit

Permalink
Remove m_MemoryBuffers completely
Browse files Browse the repository at this point in the history
  • Loading branch information
devajithvs authored and jenkins committed May 6, 2024
1 parent ab2f942 commit 4f2c339
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions lib/Interpreter/IncrementalParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,8 @@ namespace cling {
PP.enableIncrementalProcessing();

smallstream source_name;
source_name << "input_line_" << (m_MemoryBuffers.size() + 1);
// FIXME: Pre-increment to avoid failing tests.
source_name << "input_line_" << ++InputCount;

// Create an uninitialized memory buffer, copy code in and append "\n"
size_t InputSize = input.size(); // don't include trailing 0
Expand All @@ -891,8 +892,6 @@ namespace cling {
// candidates for example
SourceLocation NewLoc = getNextAvailableUniqueSourceLoc();

llvm::MemoryBuffer* MBNonOwn = MB.get();

// Create FileID for the current buffer.
FileID FID;
// Create FileEntry and FileID for the current buffer.
Expand All @@ -909,8 +908,6 @@ namespace cling {
CO.CodeCompletionOffset+1/* 1-based column*/);
}

m_MemoryBuffers.push_back(std::make_pair(MBNonOwn, FID));

// NewLoc only used for diags.
PP.EnterSourceFile(FID, /*DirLookup*/nullptr, NewLoc);
m_Consumer->getTransaction()->setBufferFID(FID);
Expand Down
4 changes: 2 additions & 2 deletions lib/Interpreter/IncrementalParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ namespace cling {
// parser (incremental)
std::unique_ptr<clang::Parser> m_Parser;

// One buffer for each command line, owner by the source file manager
std::deque<std::pair<llvm::MemoryBuffer*, clang::FileID>> m_MemoryBuffers;
/// Counts the number of direct user input lines that have been parsed.
unsigned InputCount = 0;

// file ID of the memory buffer
clang::FileID m_VirtualFileID;
Expand Down

0 comments on commit 4f2c339

Please sign in to comment.