diff --git a/src/clang_index.h b/src/clang_index.h index 187356b8..1350d900 100644 --- a/src/clang_index.h +++ b/src/clang_index.h @@ -3,6 +3,8 @@ #include // Simple RAII wrapper about CXIndex. +// Note: building a ClangIndex instance acquires a global lock, since libclang +// API does not appear to be thread-safe here. class ClangIndex { public: ClangIndex(); diff --git a/src/command_line.cc b/src/command_line.cc index 624760a6..769f156c 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -505,14 +505,12 @@ WorkThread::Result IndexMain(Config* config, QueueManager* queue) { EmitProgress(config, queue); - // TODO: dispose of index after it is not used for a while. + // Build one index per-indexer, as building the index acquires a global lock. ClangIndex index; // TODO: process all off IndexMain_DoIndex before calling - // IndexMain_DoCreateIndexUpdate for - // better icache behavior. We need to have some threads spinning on - // both though - // otherwise memory usage will get bad. + // IndexMain_DoCreateIndexUpdate for better icache behavior. We need to have + // some threads spinning on both though otherwise memory usage will get bad. // We need to make sure to run both IndexMain_DoParse and // IndexMain_DoCreateIndexUpdate so we don't starve querydb from doing any