<commit_before>// RUN: rm -rf %t && mkdir %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
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-profdata show %t/default.profdata -function=f_internal | %FileCheck %s --check-prefix=CHECK-INTERNAL
// RUN: %llvm-profdata show %t/default.profdata -function=f_private | %FileCheck %s --check-prefix=CHECK-PRIVATE
// RUN: %llvm-profdata show %t/default.profdata -function=f_public | %FileCheck %s --check-prefix=CHECK-PUBLIC
// RUN: %llvm-profdata show %t/default.profdata -function=main | %FileCheck %s --check-prefix=CHECK-MAIN
// RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | %FileCheck %s --check-prefix=CHECK-COV
// RUN: rm -rf %t

// REQUIRES: profile_runtime
// REQUIRES: OS=macosx

// CHECK-INTERNAL: Functions shown: 1
// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}func f_internal
internal func f_internal() {}

// CHECK-PRIVATE: Functions shown: 1
// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}func f_private
private func f_private() { f_internal() }

// CHECK-PUBLIC: Functions shown: 1
// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}func f_public
public func f_public() { f_private() }

class Class1 {
  var Field1 = 0

// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}init
  init() {}

// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}deinit
  deinit {}
}

// CHECK-MAIN: Maximum function count: 1
func main() {
// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}f_public
  f_public()

// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}if (true)
  if (true) {}

  var x : Int32 = 0
  while (x < 10) {
// CHECK-COV: 10|{{.*}}[[@LINE+1]]|{{.*}}x += 1
    x += 1
  }

// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}Class1
  let _ = Class1()
}

// rdar://problem/22761498 - enum declaration suppresses coverage
func foo() {
  var x : Int32 = 0   // CHECK-COV: 1|{{.*}}[[@LINE]]
  enum ETy { case A } // CHECK-COV: 1|{{.*}}[[@LINE]]
  repeat {            // CHECK-COV: 1|{{.*}}[[@LINE]]
    x += 1            // CHECK-COV: 1|{{.*}}[[@LINE]]
  } while x == 0      // CHECK-COV: 1|{{.*}}[[@LINE]]
  x += 1              // CHECK-COV: 1|{{.*}}[[@LINE]]
}

main()
foo()<commit_msg>[upstream-update] Update coverage_smoke.swift for LLVM svn r278152.<commit_after>// RUN: rm -rf %t && mkdir %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
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-profdata show %t/default.profdata -function=f_internal | %FileCheck %s --check-prefix=CHECK-INTERNAL
// RUN: %llvm-profdata show %t/default.profdata -function=f_private | %FileCheck %s --check-prefix=CHECK-PRIVATE
// RUN: %llvm-profdata show %t/default.profdata -function=f_public | %FileCheck %s --check-prefix=CHECK-PUBLIC
// RUN: %llvm-profdata show %t/default.profdata -function=main | %FileCheck %s --check-prefix=CHECK-MAIN
// RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | %FileCheck %s --check-prefix=CHECK-COV
// RUN: rm -rf %t

// REQUIRES: profile_runtime
// REQUIRES: OS=macosx

// CHECK-INTERNAL: Functions shown: 1
// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}func f_internal
internal func f_internal() {}

// CHECK-PRIVATE: Functions shown: 1
// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}func f_private
private func f_private() { f_internal() }

// CHECK-PUBLIC: Functions shown: 1
// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}func f_public
public func f_public() { f_private() }

class Class1 {
  var Field1 = 0

// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}init
  init() {}

// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}deinit
  deinit {}
}

// CHECK-MAIN: Maximum function count: 1
func main() {
// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}f_public
  f_public()

// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}if (true)
  if (true) {}

  var x : Int32 = 0
  while (x < 10) {
// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}10{{.*}}x += 1
    x += 1
  }

// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}Class1
  let _ = Class1()
}

// rdar://problem/22761498 - enum declaration suppresses coverage
func foo() {
  var x : Int32 = 0   // CHECK-COV: {{ *}}[[@LINE]]|{{ *}}1
  enum ETy { case A } // CHECK-COV: {{ *}}[[@LINE]]|{{ *}}1
  repeat {            // CHECK-COV: {{ *}}[[@LINE]]|{{ *}}1
    x += 1            // CHECK-COV: {{ *}}[[@LINE]]|{{ *}}1
  } while x == 0      // CHECK-COV: {{ *}}[[@LINE]]|{{ *}}1
  x += 1              // CHECK-COV: {{ *}}[[@LINE]]|{{ *}}1
}

main()
foo()
{'fraction_non_alphanumeric': 0.2556197816313423, 'fraction_numerical': 0.024834082637550846, 'mean_word_length': 3.3379758588672237, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5607695', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1809, 'n_words': 392}