diff options
author | Eric Liu <ioeric@google.com> | 2018-01-17 17:37:11 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2018-01-17 17:37:11 +0000 |
commit | 6828ee3c1d43be395fc69faf9c664bbc7ff59158 (patch) | |
tree | 040311437c4b0696d1b84dbd79f17aeeb8eff8cc /clang/lib/Tooling/AllTUsExecution.cpp | |
parent | e2e3e67cf1a7c2fda14f76200d665662b1fdfaa5 (diff) | |
download | bcm5719-llvm-6828ee3c1d43be395fc69faf9c664bbc7ff59158.tar.gz bcm5719-llvm-6828ee3c1d43be395fc69faf9c664bbc7ff59158.zip |
[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
llvm-svn: 322691
Diffstat (limited to 'clang/lib/Tooling/AllTUsExecution.cpp')
-rw-r--r-- | clang/lib/Tooling/AllTUsExecution.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/Tooling/AllTUsExecution.cpp b/clang/lib/Tooling/AllTUsExecution.cpp index d35f82f40c5..0c0854d0ba8 100644 --- a/clang/lib/Tooling/AllTUsExecution.cpp +++ b/clang/lib/Tooling/AllTUsExecution.cpp @@ -33,24 +33,20 @@ class ThreadSafeToolResults : public ToolResults { 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. |