From adf9d598cc003b0dbbe89a58cefd1ea95f505ba9 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 09:42:20 -0400 Subject: [PATCH] Check value of __clang_major__ --- .../Events/Recorder/Event.HumanReadableOutputRecorder.swift | 3 +++ Sources/_TestingInternals/Versions.cpp | 4 ++++ Sources/_TestingInternals/include/Versions.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift b/Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift index 32d1ce770..5a0f331b6 100644 --- a/Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift +++ b/Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift @@ -8,6 +8,8 @@ // See https://swift.org/CONTRIBUTORS.txt for Swift project authors // +private import _TestingInternals + extension Event { /// A type which handles ``Event`` instances and outputs representations of /// them as human-readable messages. @@ -356,6 +358,7 @@ extension Event.HumanReadableOutputRecorder { case .runStarted: var comments = [Comment]() + comments.append("Clang Major: \(clangMajor())") if verbosity > 0 { if let swiftStandardLibraryVersion { comments.append("Swift Standard Library Version: \(swiftStandardLibraryVersion)") diff --git a/Sources/_TestingInternals/Versions.cpp b/Sources/_TestingInternals/Versions.cpp index bd8f2314a..63fc4fbfe 100644 --- a/Sources/_TestingInternals/Versions.cpp +++ b/Sources/_TestingInternals/Versions.cpp @@ -14,6 +14,10 @@ #include #include +int clangMajor(void) { + return __clang_major__; +} + const char *swt_getTestingLibraryVersion(void) { #if defined(SWT_TESTING_LIBRARY_VERSION) // The current environment explicitly specifies a version string to return. diff --git a/Sources/_TestingInternals/include/Versions.h b/Sources/_TestingInternals/include/Versions.h index b188a4d66..fb2f3835c 100644 --- a/Sources/_TestingInternals/include/Versions.h +++ b/Sources/_TestingInternals/include/Versions.h @@ -30,6 +30,8 @@ static inline uint64_t swt_getSwiftCompilerVersion(void) { #endif } +SWT_EXTERN int clangMajor(void); + /// Get the human-readable version of the testing library. /// /// - Returns: A human-readable string describing the version of the testing