Author: ioeric Date: Wed Jan 17 09:37:11 2018 New Revision: 322691 URL: http://llvm.org/viewvc/llvm-project?rev=322691&view=rev Log: [Tooling] Don't deduplicate tool results in the All-TUs executor.
Summary: As result deduplication or reduction is not supported in the framework, we should leave the deplication to tools (if needed) until the framework supports it. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42111 Modified: cfe/trunk/include/clang/Tooling/AllTUsExecution.h cfe/trunk/lib/Tooling/AllTUsExecution.cpp Modified: cfe/trunk/include/clang/Tooling/AllTUsExecution.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/AllTUsExecution.h?rev=322691&r1=322690&r2=322691&view=diff ============================================================================== --- cfe/trunk/include/clang/Tooling/AllTUsExecution.h (original) +++ cfe/trunk/include/clang/Tooling/AllTUsExecution.h Wed Jan 17 09:37:11 2018 @@ -22,7 +22,7 @@ namespace clang { 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; Modified: cfe/trunk/lib/Tooling/AllTUsExecution.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/AllTUsExecution.cpp?rev=322691&r1=322690&r2=322691&view=diff ============================================================================== --- cfe/trunk/lib/Tooling/AllTUsExecution.cpp (original) +++ cfe/trunk/lib/Tooling/AllTUsExecution.cpp Wed Jan 17 09:37:11 2018 @@ -33,24 +33,20 @@ class ThreadSafeToolResults : public Too public: void addResult(StringRef Key, StringRef Value) override { std::unique_lock<std::mutex> LockGuard(Mutex); - Results[Key] = Value; + Results.addResult(Key, Value); } std::vector<std::pair<std::string, std::string>> AllKVResults() override { - std::vector<std::pair<std::string, std::string>> KVs; - for (const auto &Pair : Results) - KVs.emplace_back(Pair.first().str(), Pair.second); - return KVs; + return Results.AllKVResults(); } void forEachResult(llvm::function_ref<void(StringRef Key, StringRef Value)> Callback) override { - for (const auto &Pair : Results) - Callback(Pair.first(), Pair.second); + Results.forEachResult(Callback); } private: - llvm::StringMap<std::string> Results; + InMemoryToolResults Results; std::mutex Mutex; }; @@ -153,9 +149,8 @@ public: }; static ToolExecutorPluginRegistry::Add<AllTUsToolExecutorPlugin> - 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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits