From 7317a5cbfcf7c309ca3c5635ec9fac9b1f3a76f1 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 28 Mar 2012 02:18:05 +0000 Subject: [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 --- clang/tools/libclang/CIndexer.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'clang/tools/libclang/CIndexer.h') 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); } -- cgit v1.2.3