[clang-tools-extra] r291653 - Only launch asynchronously if threading is enabled.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 10 23:20:46 PST 2017


Author: klimek
Date: Wed Jan 11 01:20:46 2017
New Revision: 291653

URL: http://llvm.org/viewvc/llvm-project?rev=291653&view=rev
Log:
Only launch asynchronously if threading is enabled.

Modified:
    clang-tools-extra/trunk/include-fixer/SymbolIndexManager.h

Modified: clang-tools-extra/trunk/include-fixer/SymbolIndexManager.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/SymbolIndexManager.h?rev=291653&r1=291652&r2=291653&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/SymbolIndexManager.h (original)
+++ clang-tools-extra/trunk/include-fixer/SymbolIndexManager.h Wed Jan 11 01:20:46 2017
@@ -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.




More information about the cfe-commits mailing list