diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp index b8fcb5f374..7a522bd1b5 100644 --- a/lib/Interpreter/IncrementalParser.cpp +++ b/lib/Interpreter/IncrementalParser.cpp @@ -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 @@ -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. @@ -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); diff --git a/lib/Interpreter/IncrementalParser.h b/lib/Interpreter/IncrementalParser.h index df416b1228..44b2bf0233 100644 --- a/lib/Interpreter/IncrementalParser.h +++ b/lib/Interpreter/IncrementalParser.h @@ -64,8 +64,8 @@ namespace cling { // parser (incremental) std::unique_ptr m_Parser; - // One buffer for each command line, owner by the source file manager - std::deque> 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;