diff options
author | Vedant Kumar <vsk@apple.com> | 2017-08-01 21:23:26 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-08-01 21:23:26 +0000 |
commit | e72b881e28650cb295e04bfad448f203d58f27eb (patch) | |
tree | 2831a50d7e536afe17dccf098594857c8db516c0 /tools/llvm-cov/CodeCoverage.cpp | |
parent | e08253200c963067b39fb24e74ec748441922eb2 (diff) |
[llvm-cov] Allow specifying distinct architectures for each loaded binary
The coverage tool needs to know which slice to look at when it's handed
a universal binary. Some projects need to look at aggregate coverage
reports for a variety of slices in different binaries: this patch adds
support for these kinds of projects to llvm-cov.
rdar://problem/33579007
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-cov/CodeCoverage.cpp')
-rw-r--r-- | tools/llvm-cov/CodeCoverage.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tools/llvm-cov/CodeCoverage.cpp b/tools/llvm-cov/CodeCoverage.cpp index 3cbd6591134..073bd83e7af 100644 --- a/tools/llvm-cov/CodeCoverage.cpp +++ b/tools/llvm-cov/CodeCoverage.cpp @@ -133,7 +133,7 @@ private: StringMap<std::string> RemappedFilenames; /// The architecture the coverage mapping data targets. - std::string CoverageArch; + std::vector<StringRef> CoverageArches; /// A cache for demangled symbols. DemangleCache DC; @@ -329,7 +329,7 @@ std::unique_ptr<CoverageMapping> CodeCoverageTool::load() { warning("profile data may be out of date - object is newer", ObjectFilename); auto CoverageOrErr = - CoverageMapping::load(ObjectFilenames, PGOFilename, CoverageArch); + CoverageMapping::load(ObjectFilenames, PGOFilename, CoverageArches); if (Error E = CoverageOrErr.takeError()) { error("Failed to load coverage: " + toString(std::move(E)), join(ObjectFilenames.begin(), ObjectFilenames.end(), ", ")); @@ -499,8 +499,8 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { cl::desc( "File with the profile data obtained after an instrumented run")); - cl::opt<std::string> Arch( - "arch", cl::desc("architecture of the coverage mapping binary")); + cl::list<std::string> Arches( + "arch", cl::desc("architectures of the coverage mapping binaries")); cl::opt<bool> DebugDump("dump", cl::Optional, cl::desc("Show internal debug dump")); @@ -632,12 +632,19 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { Filters.push_back(std::unique_ptr<CoverageFilter>(StatFilterer)); } - if (!Arch.empty() && - Triple(Arch).getArch() == llvm::Triple::ArchType::UnknownArch) { - error("Unknown architecture: " + Arch); - return 1; + if (!Arches.empty()) { + for (const std::string &Arch : Arches) { + if (Triple(Arch).getArch() == llvm::Triple::ArchType::UnknownArch) { + error("Unknown architecture: " + Arch); + return 1; + } + CoverageArches.emplace_back(Arch); + } + if (CoverageArches.size() != ObjectFilenames.size()) { + error("Number of architectures doesn't match the number of objects"); + return 1; + } } - CoverageArch = Arch; for (const std::string &File : InputSourceFiles) collectPaths(File); |