diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-28 02:18:05 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-28 02:18:05 +0000 |
commit | fdc1795acc9d5d73a767cc7d43ad1546e93adbba (patch) | |
tree | 67f7fb7e785961ad689e7dd78c415300c3bf2a33 /tools/libclang/Indexing.cpp | |
parent | bbca564eec4eb841848a40014f7ddc9e5807125e (diff) |
[libclang] Introduce options to control the priority for the threads
that libclang creates.
-Introduce CXGlobalOptFlags enum for the new options that can be
set on the CXIndex object.
-CXGlobalOpt_ThreadBackgroundPriorityForIndexing affects:
clang_indexSourceFile
clang_indexTranslationUnit
clang_parseTranslationUnit
clang_saveTranslationUnit
-CXGlobalOpt_ThreadBackgroundPriorityForEditing affects:
clang_reparseTranslationUnit
clang_codeCompleteAt
clang_annotateTokens
rdar://9075282
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/Indexing.cpp')
-rw-r--r-- | tools/libclang/Indexing.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index 85b638530f..905569dccd 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -275,6 +275,9 @@ static void clang_indexSourceFile_Impl(void *UserData) { CIndexer *CXXIdx = static_cast<CIndexer *>(CIdx); + if (CXXIdx->isOptEnabled(CXGlobalOpt_ThreadBackgroundPriorityForIndexing)) + setBackGroundPriority(); + CaptureDiagnosticConsumer *CaptureDiag = new CaptureDiagnosticConsumer(); // Configure the diagnostics. @@ -351,7 +354,7 @@ static void clang_indexSourceFile_Impl(void *UserData) { ASTUnit *Unit = ASTUnit::create(CInvok.getPtr(), Diags, /*CaptureDiagnostics=*/true); - OwningPtr<CXTUOwner> CXTU(new CXTUOwner(MakeCXTranslationUnit(Unit))); + OwningPtr<CXTUOwner> CXTU(new CXTUOwner(MakeCXTranslationUnit(CXXIdx, Unit))); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<CXTUOwner> @@ -502,6 +505,10 @@ static void clang_indexTranslationUnit_Impl(void *UserData) { if (!client_index_callbacks || index_callbacks_size == 0) return; + CIndexer *CXXIdx = (CIndexer*)TU->CIdx; + if (CXXIdx->isOptEnabled(CXGlobalOpt_ThreadBackgroundPriorityForIndexing)) + setBackGroundPriority(); + IndexerCallbacks CB; memset(&CB, 0, sizeof(CB)); unsigned ClientCBSize = index_callbacks_size < sizeof(CB) |