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/CIndexer.h | |
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/CIndexer.h')
-rw-r--r-- | clang/tools/libclang/CIndexer.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/tools/libclang/CIndexer.h b/clang/tools/libclang/CIndexer.h index de7cc88a2c6..f8cb8dc1feb 100644 --- a/clang/tools/libclang/CIndexer.h +++ b/clang/tools/libclang/CIndexer.h @@ -29,12 +29,14 @@ namespace clang { class CIndexer { bool OnlyLocalDecls; bool DisplayDiagnostics; + unsigned Options; // CXGlobalOptFlags. llvm::sys::Path ResourcesPath; std::string WorkingDir; public: - CIndexer() : OnlyLocalDecls(false), DisplayDiagnostics(false) { } + CIndexer() : OnlyLocalDecls(false), DisplayDiagnostics(false), + Options(CXGlobalOpt_None) { } /// \brief Whether we only want to see "local" declarations (that did not /// come from a previous precompiled header). If false, we want to see all @@ -47,6 +49,13 @@ public: DisplayDiagnostics = Display; } + unsigned getCXGlobalOptFlags() const { return Options; } + void setCXGlobalOptFlags(unsigned options) { Options = options; } + + bool isOptEnabled(CXGlobalOptFlags opt) const { + return Options & ~unsigned(opt); + } + /// \brief Get the path of the clang resource files. std::string getClangResourcesPath(); @@ -79,6 +88,10 @@ public: bool RunSafely(llvm::CrashRecoveryContext &CRC, void (*Fn)(void*), void *UserData, unsigned Size = 0); + /// \brief Set the thread priority to background. + /// FIXME: Move to llvm/Support. + void setBackGroundPriority(); + /// \brief Print libclang's resource usage to standard error. void PrintLibclangResourceUsage(CXTranslationUnit TU); } |