ioeric created this revision. ioeric added reviewers: bkramer, sammccall. Herald added subscribers: cfe-commits, ilya-biryukov, klimek.
After https://reviews.llvm.org/D42111, the executor framework no longer deduplicate tool results. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D42113 Files: clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp Index: clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp =================================================================== --- clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp +++ clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp @@ -105,7 +105,17 @@ llvm::errs() << llvm::toString(std::move(Err)) << "\n"; } + // Deduplicate the result by key. + // FIXME(ioeric): we need a better way to merge symbols with the same key. For + // example, class forward-declarations can have the same key as the class + // definition, and we should merge them instead of ignoring one of them. We + // would also need to aggregate signals like usage count when they are added. + llvm::StringMap<llvm::StringRef> ReducedSymbols; Executor->get()->getToolResults()->forEachResult( - [](llvm::StringRef, llvm::StringRef Value) { llvm::outs() << Value; }); + [&ReducedSymbols](llvm::StringRef Key, llvm::StringRef Value) { + ReducedSymbols[Key] = Value; + }); + for (const auto &Sym : ReducedSymbols) + llvm::outs() << Sym.second; return 0; }
Index: clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp =================================================================== --- clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp +++ clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp @@ -105,7 +105,17 @@ llvm::errs() << llvm::toString(std::move(Err)) << "\n"; } + // Deduplicate the result by key. + // FIXME(ioeric): we need a better way to merge symbols with the same key. For + // example, class forward-declarations can have the same key as the class + // definition, and we should merge them instead of ignoring one of them. We + // would also need to aggregate signals like usage count when they are added. + llvm::StringMap<llvm::StringRef> ReducedSymbols; Executor->get()->getToolResults()->forEachResult( - [](llvm::StringRef, llvm::StringRef Value) { llvm::outs() << Value; }); + [&ReducedSymbols](llvm::StringRef Key, llvm::StringRef Value) { + ReducedSymbols[Key] = Value; + }); + for (const auto &Sym : ReducedSymbols) + llvm::outs() << Sym.second; return 0; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits