Skip to content

Fixed error [-1:-1] unexpected end of stream of schema_compiler in LLVM18 OSX #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tool/schema_compiler/src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,19 @@ int main(int argc, char **argv)
std::ifstream stream(file);
if (not stream.is_open())
return 1;

auto tokens = minecpp::tool::schema_compiler::lex_input(stream);
/**
* Internal parser uses std::basic_istream<CharT,Traits>::readsome to read from the stream
* which is highly implementation specific and was returning empty on LLVM18 in OSX.
*
* Therefore we create a stringstream to read from the file into memory, where readsome()
* function will then return non-empty, as the contents are in memory.
*
* https://en.cppreference.com/w/cpp/io/basic_istream/readsome
*/
std::stringstream in_memory_stream;
in_memory_stream << stream.rdbuf();
in_memory_stream.seekg(0);
auto tokens = minecpp::tool::schema_compiler::lex_input(in_memory_stream);
minecpp::tool::schema_compiler::Parser parser(tokens);

try {
Expand Down