mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibCpp: Add "ignore invalid statements" option to Preprocessor
When we run the Preprocessor from the CppComprehensionEngine of the language server, we don't want the preprocessor to crash if it encounters an invalid preprocessor statement (for example, an #endif statement without an accompanying previous #if statement). To achieve this, this commit adds an "ignore_invalid_statements" flag to the preprocessor which is set by the CppComprehensionEngine. Fixes #11064.
This commit is contained in:
@@ -574,6 +574,7 @@ OwnPtr<CppComprehensionEngine::DocumentData> CppComprehensionEngine::create_docu
|
||||
document_data->m_text = move(text);
|
||||
document_data->m_preprocessor = make<Preprocessor>(document_data->m_filename, document_data->text());
|
||||
document_data->preprocessor().set_ignore_unsupported_keywords(true);
|
||||
document_data->preprocessor().set_ignore_invalid_statements(true);
|
||||
document_data->preprocessor().set_keep_include_statements(true);
|
||||
|
||||
document_data->preprocessor().definitions_in_header_callback = [this](StringView include_path) -> Preprocessor::Definitions {
|
||||
|
||||
Reference in New Issue
Block a user