Only launch asynchronously if threading is enabled.

llvm-svn: 291653
This commit is contained in:
Manuel Klimek 2017-01-11 07:20:46 +00:00
parent d6c18657bb
commit f38d74e78b
1 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,12 @@ namespace include_fixer {
class SymbolIndexManager {
public:
void addSymbolIndex(std::function<std::unique_ptr<SymbolIndex>()> F) {
SymbolIndices.push_back(std::async(std::launch::async, F));
#if LLVM_ENABLE_THREADS
auto Strategy = std::launch::async;
#else
auto Strategy = std::launch::deferred;
#endif
SymbolIndices.push_back(std::async(Strategy, F));
}
/// Search for header files to be included for an identifier.