Index: include/clang/Tooling/AllTUsExecution.h =================================================================== --- include/clang/Tooling/AllTUsExecution.h +++ include/clang/Tooling/AllTUsExecution.h @@ -22,7 +22,7 @@ namespace tooling { /// \brief Executes given frontend actions on all files/TUs in the compilation -/// database. The final results will be deduplicated by the result key. +/// database. class AllTUsToolExecutor : public ToolExecutor { public: static const char *ExecutorName; Index: lib/Tooling/AllTUsExecution.cpp =================================================================== --- lib/Tooling/AllTUsExecution.cpp +++ lib/Tooling/AllTUsExecution.cpp @@ -33,24 +33,20 @@ public: void addResult(StringRef Key, StringRef Value) override { std::unique_lock LockGuard(Mutex); - Results[Key] = Value; + Results.addResult(Key, Value); } std::vector> AllKVResults() override { - std::vector> KVs; - for (const auto &Pair : Results) - KVs.emplace_back(Pair.first().str(), Pair.second); - return KVs; + return Results.AllKVResults(); } void forEachResult(llvm::function_ref Callback) override { - for (const auto &Pair : Results) - Callback(Pair.first(), Pair.second); + Results.forEachResult(Callback); } private: - llvm::StringMap Results; + InMemoryToolResults Results; std::mutex Mutex; }; @@ -153,9 +149,8 @@ }; static ToolExecutorPluginRegistry::Add - X("all-TUs", - "Runs FrontendActions on all TUs in the compilation database. " - "Tool results are deduplicated by the result key and stored in memory."); + X("all-TUs", "Runs FrontendActions on all TUs in the compilation database. " + "Tool results are stored in memory."); // This anchor is used to force the linker to link in the generated object file // and thus register the plugin.