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 | 7317a5cbfcf7c309ca3c5635ec9fac9b1f3a76f1 (patch) | |
tree | e181054664ae06fc89dc952fb8cdee28956d1160 /clang/tools/libclang/Indexing.cpp | |
parent | c557bada5a2f61f70aaaecc7a38607934c1f5ee9 (diff) | |
download | bcm5719-llvm-7317a5cbfcf7c309ca3c5635ec9fac9b1f3a76f1.tar.gz bcm5719-llvm-7317a5cbfcf7c309ca3c5635ec9fac9b1f3a76f1.zip |
[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
llvm-svn: 153562
Diffstat (limited to 'clang/tools/libclang/Indexing.cpp')
-rw-r--r-- | clang/tools/libclang/Indexing.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp index 85b638530f1..905569dccd1 100644 --- a/clang/tools/libclang/Indexing.cpp +++ b/clang/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) |