From f66e59ee9e94764e640b602960887de6cb523975 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sat, 30 Apr 2016 14:56:48 +0200 Subject: [PATCH] SourceClang: moved retrieving diagnostics away from main thread, since large number of warnings (>100) would lead to temporary nonresponsive application --- src/source_clang.cc | 2 +- src/source_clang.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/source_clang.cc b/src/source_clang.cc index 2ed5be5..52c954e 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -122,6 +122,7 @@ void Source::ClangViewParse::parse_initialize() { auto expected=ParseProcessState::PROCESSING; if(parse_process_state.compare_exchange_strong(expected, ParseProcessState::POSTPROCESSING)) { clang_tokens=clang_tu->get_tokens(0, parse_thread_buffer.bytes()-1); + diagnostics=clang_tu->get_diagnostics(); parse_lock.unlock(); dispatcher.post([this] { std::unique_lock parse_lock(parse_mutex, std::defer_lock); @@ -257,7 +258,6 @@ void Source::ClangViewParse::update_diagnostics() { fix_its.clear(); get_buffer()->remove_tag_by_name("def:warning_underline", get_buffer()->begin(), get_buffer()->end()); get_buffer()->remove_tag_by_name("def:error_underline", get_buffer()->begin(), get_buffer()->end()); - auto diagnostics=clang_tu->get_diagnostics(); size_t num_warnings=0; size_t num_errors=0; size_t num_fix_its=0; diff --git a/src/source_clang.h b/src/source_clang.h index ba1dfe8..ac7b7e8 100644 --- a/src/source_clang.h +++ b/src/source_clang.h @@ -53,7 +53,9 @@ namespace Source { void update_syntax(); std::set last_syntax_tags; + void update_diagnostics(); + std::vector diagnostics; static clang::Index clang_index; std::vector get_compilation_commands();