Clang: Disable internal threads in libclang

We already run all operations in threads to avoid blocking, there is no
need to start more threads within libclang. Before this change, a
reparse would trigger 3 threads to start:
  1. clangbackend: Utils::runAsync() for the job
  2. libclang-internal: thread for reparse
  3. libclang-internal: thread for annotating tokens (highlighting)

Ensure that we use the same stack size for our threads as libclang was
doing internally. C++ parsers usually have higher stack size
requirements.

Change-Id: I2f67602ddfbf77ea2c69144b56acf64ba08041f6
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-02-09 11:11:22 +01:00
parent 14a9133abb
commit 89d6a36bc6
4 changed files with 20 additions and 1 deletions

View File

@@ -58,7 +58,9 @@ public:
&QFutureWatcher<Result>::finished,
onFinished);
const QFuture<Result> future = Utils::runAsync(m_runner);
// Use 16MB stack size as clang_annotateTokens() would with an internal thread.
const Utils::StackSizeInBytes stackSize = 1024 * 1024 * 16;
const QFuture<Result> future = Utils::runAsync(stackSize, m_runner);
m_futureWatcher.setFuture(future);
return future;