<commit_before>// RUN: %empty-directory(%t)

// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil %S/Inputs/multithread_module/main.swift -emit-ir -o %t/main.ll %s -o %t/mt_module.ll -num-threads 2 -O -g -module-name test
// RUN: %FileCheck --check-prefix=CHECK-MAINLL %s <%t/main.ll
// RUN: %FileCheck --check-prefix=CHECK-MODULELL %s <%t/mt_module.ll

// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -c %S/Inputs/multithread_module/main.swift -o %t/main.o %s -o %t/mt_module.o -num-threads 2 -O -g -module-name test
// RUN: %target-build-swift %t/main.o %t/mt_module.o -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out | %FileCheck %s
// REQUIRES: executable_test


// Test compilation of a module in multi-threaded compilation.
// The main purpose of the test is to check that the generated LLVM modules are not corrupt
// and that linking succeeds.

// CHECK: 28
// CHECK: 125
// CHECK: 42
// CHECK: 237

public func testit(_ x: Int) -> Int {
	return incrementit(x)
}

public class Base {
	func memberfunc(_ x: Int) -> Int {
		return x + 1
	}
}

public var g2 = 123

@inline(never)
func callmember(_ b: Base) -> Int {
	return b.memberfunc(g2)
}

@inline(never)
private func privateInc(_ x: Int) -> Int {
	return x + 3
}

func callPrivInc(_ x: Int) -> Int {
	return privateInc(x)
}

// Check if we use the correct linkage for a transparent function
public var transparentfuncptr = transparentfunc

protocol MyProto {
	func protofunc() -> Int
}

@inline(never)
func callproto(_ p: MyProto) {
	print(p.protofunc())
}

// Check the llvm IR files:

// Check if the DI filename is correct and not "<unknown>".

// CHECK-MAINLL: DICompileUnit(language: DW_LANG_Swift, file: [[F:![0-9]+]]
// CHECK-MAINLL: [[F]] = !DIFile(filename: "{{.*}}IRGen/Inputs/multithread_module/main.swift", directory: "{{.*}}")

// CHECK-MODULELL: DICompileUnit(language: DW_LANG_Swift, file: [[F:![0-9]+]]
// CHECK-MODULELL: [[F]] = !DIFile(filename: "{{.*}}IRGen/multithread_module.swift", directory: "{{.*}}")
<commit_msg>test: normalize path for test<commit_after>// RUN: %empty-directory(%t)

// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil %S/Inputs/multithread_module/main.swift -emit-ir -o %t/main.ll %/s -o %t/mt_module.ll -num-threads 2 -O -g -module-name test
// RUN: %FileCheck --check-prefix=CHECK-MAINLL %s <%t/main.ll
// RUN: %FileCheck --check-prefix=CHECK-MODULELL %s <%t/mt_module.ll

// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -c %S/Inputs/multithread_module/main.swift -o %t/main.o %s -o %t/mt_module.o -num-threads 2 -O -g -module-name test
// RUN: %target-build-swift %t/main.o %t/mt_module.o -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out | %FileCheck %s
// REQUIRES: executable_test


// Test compilation of a module in multi-threaded compilation.
// The main purpose of the test is to check that the generated LLVM modules are not corrupt
// and that linking succeeds.

// CHECK: 28
// CHECK: 125
// CHECK: 42
// CHECK: 237

public func testit(_ x: Int) -> Int {
	return incrementit(x)
}

public class Base {
	func memberfunc(_ x: Int) -> Int {
		return x + 1
	}
}

public var g2 = 123

@inline(never)
func callmember(_ b: Base) -> Int {
	return b.memberfunc(g2)
}

@inline(never)
private func privateInc(_ x: Int) -> Int {
	return x + 3
}

func callPrivInc(_ x: Int) -> Int {
	return privateInc(x)
}

// Check if we use the correct linkage for a transparent function
public var transparentfuncptr = transparentfunc

protocol MyProto {
	func protofunc() -> Int
}

@inline(never)
func callproto(_ p: MyProto) {
	print(p.protofunc())
}

// Check the llvm IR files:

// Check if the DI filename is correct and not "<unknown>".

// CHECK-MAINLL: DICompileUnit(language: DW_LANG_Swift, file: [[F:![0-9]+]]
// CHECK-MAINLL: [[F]] = !DIFile(filename: "{{.*}}IRGen/Inputs/multithread_module/main.swift", directory: "{{.*}}")

// CHECK-MODULELL: DICompileUnit(language: DW_LANG_Swift, file: [[F:![0-9]+]]
// CHECK-MODULELL: [[F]] = !DIFile(filename: "{{.*}}IRGen/multithread_module.swift", directory: "{{.*}}")

{'fraction_non_alphanumeric': 0.16999759210209486, 'fraction_numerical': 0.011076330363592584, 'mean_word_length': 3.6990950226244346, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '803420', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1522, 'n_words': 418}