Changed FrontendActionFactory::create to return a std::unique_ptr
[lldb.git] / clang-tools-extra / clangd / indexer / IndexerMain.cpp
index 97d8d12..dac0383 100644 (file)
@@ -39,37 +39,36 @@ class IndexActionFactory : public tooling::FrontendActionFactory {
 public:
   IndexActionFactory(IndexFileIn &Result) : Result(Result) {}
 
-  clang::FrontendAction *create() override {
+  std::unique_ptr<FrontendAction> create() override {
     SymbolCollector::Options Opts;
     Opts.CountReferences = true;
     return createStaticIndexingAction(
-               Opts,
-               [&](SymbolSlab S) {
-                 // Merge as we go.
-                 std::lock_guard<std::mutex> Lock(SymbolsMu);
-                 for (const auto &Sym : S) {
-                   if (const auto *Existing = Symbols.find(Sym.ID))
-                     Symbols.insert(mergeSymbol(*Existing, Sym));
-                   else
-                     Symbols.insert(Sym);
-                 }
-               },
-               [&](RefSlab S) {
-                 std::lock_guard<std::mutex> Lock(SymbolsMu);
-                 for (const auto &Sym : S) {
-                   // Deduplication happens during insertion.
-                   for (const auto &Ref : Sym.second)
-                     Refs.insert(Sym.first, Ref);
-                 }
-               },
-               [&](RelationSlab S) {
-                 std::lock_guard<std::mutex> Lock(SymbolsMu);
-                 for (const auto &R : S) {
-                   Relations.insert(R);
-                 }
-               },
-               /*IncludeGraphCallback=*/nullptr)
-        .release();
+        Opts,
+        [&](SymbolSlab S) {
+          // Merge as we go.
+          std::lock_guard<std::mutex> Lock(SymbolsMu);
+          for (const auto &Sym : S) {
+            if (const auto *Existing = Symbols.find(Sym.ID))
+              Symbols.insert(mergeSymbol(*Existing, Sym));
+            else
+              Symbols.insert(Sym);
+          }
+        },
+        [&](RefSlab S) {
+          std::lock_guard<std::mutex> Lock(SymbolsMu);
+          for (const auto &Sym : S) {
+            // Deduplication happens during insertion.
+            for (const auto &Ref : Sym.second)
+              Refs.insert(Sym.first, Ref);
+          }
+        },
+        [&](RelationSlab S) {
+          std::lock_guard<std::mutex> Lock(SymbolsMu);
+          for (const auto &R : S) {
+            Relations.insert(R);
+          }
+        },
+        /*IncludeGraphCallback=*/nullptr);
   }
 
   // Awkward: we write the result in the destructor, because the executor