Files
swift-mirror/test/Profiler/coverage_non_constructible_enum.swift
Hamish Knight 5a8c14d583 [Profiler] Fix up a couple uses of emitProfilerIncrement
Remove a case where we know we don't have a
profiler, and avoid incrementing for a distributed
factory method. Otherwise such cases could pass
a null ASTNode, which will become an assertion
failure in a future commit.

While we're here, let's standardize on emitting
the profiler increment for function entry after
the prolog, as if there's e.g an unreachable
parameter, the increment can be safely elided
anyway.
2022-10-13 19:42:36 +01:00

17 lines
733 B
Swift

// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_non_constructible_enum %s | %FileCheck %s
// Reduced from Carthage (https://github.com/Carthage/Carthage).
enum NoError: Error, Equatable {
// We don't need to emit the increment_profiler_counter, as the function is
// uncallable.
// CHECK-LABEL: static coverage_non_constructible_enum.NoError.== infix
// CHECK-NOT: increment_profiler_counter
// CHECK: unreachable
// CHECK-LABEL: sil_coverage_map {{.*}} static coverage_non_constructible_enum.NoError.== infix
// CHECK-NEXT: [[@LINE+1]]:54 -> [[@LINE+3]]:4 : 0
static func ==(lhs: NoError, rhs: NoError) -> Bool {
return true
}
}