Skip to content

Commit

Permalink
Merge pull request swiftlang#6424 from vedantk/re-reenable-coverage-s…
Browse files Browse the repository at this point in the history
…moke

[Coverage] Fix UB in use of the CoverageMappingWriter API
  • Loading branch information
vedantk authored Dec 21, 2016
2 parents e264d02 + a064157 commit 9dceb9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/IRGen/GenCoverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ void IRGenModule::emitCoverageMapping() {
MR.Counter, /*FileID=*/0, MR.StartLine, MR.StartCol, MR.EndLine,
MR.EndCol));
// Append each function's regions into the encoded buffer.
llvm::coverage::CoverageMappingWriter W({FileID}, M.getExpressions(),
Regions);
ArrayRef<unsigned> VirtualFileMapping(FileID);
llvm::coverage::CoverageMappingWriter W(VirtualFileMapping,
M.getExpressions(), Regions);
W.write(OS);

std::string NameValue = llvm::getPGOFuncName(
Expand Down
1 change: 0 additions & 1 deletion test/SILGen/coverage_smoke.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// REQUIRES: rdar://29591622
// RUN: rm -rf %t && mkdir -p %t
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -Xfrontend -disable-incremental-llvm-codegen -o %t/main
// RUN: env LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
Expand Down

0 comments on commit 9dceb9f

Please sign in to comment.