diff --git a/llvm/test/tools/llvm-cov/universal-binary.c b/llvm/test/tools/llvm-cov/universal-binary.c --- a/llvm/test/tools/llvm-cov/universal-binary.c +++ b/llvm/test/tools/llvm-cov/universal-binary.c @@ -7,6 +7,8 @@ // RUN: llvm-cov show %S/Inputs/universal-binary -instr-profile %t.profdata -path-equivalence=/tmp,%S %s -arch x86_64 | FileCheck %s // RUN: llvm-cov report %S/Inputs/universal-binary -arch x86_64 -object %S/Inputs/templateInstantiations.covmapping -arch i386 -instr-profile %t.profdata 2>&1 | FileCheck %s --check-prefix=COMBINED +// RUN: llvm-cov report %S/Inputs/universal-binary -arch x86_64 -object %S/Inputs/templateInstantiations.covmapping -instr-profile %t.profdata 2>&1 | FileCheck %s --check-prefix=COMBINED +// RUN: not llvm-cov report %S/Inputs/universal-binary -arch i386 -object %S/Inputs/templateInstantiations.covmapping -instr-profile %t.profdata 2>&1 | FileCheck %s --check-prefix=WRONG-ARCH // COMBINED: showTemplateInstantiations.cpp // COMBINED-NEXT: universal-binary.c diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -883,6 +883,9 @@ } CoverageArches.emplace_back(Arch); } + if (CoverageArches.size() == 1) + CoverageArches.insert(CoverageArches.end(), ObjectFilenames.size() - 1, + CoverageArches[0]); if (CoverageArches.size() != ObjectFilenames.size()) { error("Number of architectures doesn't match the number of objects"); return 1;