Skip to content

[windows] split out complex module from ucrt module, to allow new swi… #75721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions stdlib/public/Platform/ucrt.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
//
//===----------------------------------------------------------------------===//

module _complex [system] {
header "complex.h"
export *
}

module ucrt [system] {
module C {
module complex {
/* disallow the header in C++ mode as it forwards to `ccomplex`. */
requires !cplusplus

header "complex.h"
export *
}

module ctype {
header "ctype.h"
export *
Expand Down
2 changes: 2 additions & 0 deletions stdlib/public/Platform/ucrt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
//===----------------------------------------------------------------------===//

@_exported import ucrt // Clang module
// Extra clang module that's split out from ucrt:
@_exported import _complex

@available(swift, deprecated: 3.0, message: "Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.")
public let M_PI = Double.pi
Expand Down
4 changes: 1 addition & 3 deletions test/Interop/Cxx/stdlib/foundation-and-std-module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
// RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++17 -Xcc -fmodules-cache-path=%t
// RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -fmodules-cache-path=%t

// RUN: find %t | %FileCheck %s

// RUN: %empty-directory(%t)

// RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++17 -Xcc -fmodules-cache-path=%t -DADD_CXXSTDLIB
// RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -fmodules-cache-path=%t -DADD_CXXSTDLIB

// REQUIRES: OS=macosx || OS=linux-gnu
// RUN: %{python} -c "import os, glob; print('\n'.join(glob.glob(os.path.join('%/t', '**', '*.pcm'), recursive=True)))" | %FileCheck %s

#if canImport(Foundation)
import Foundation
Expand Down
12 changes: 12 additions & 0 deletions test/stdlib/CRTWinAPIs.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %target-typecheck-verify-swift
// REQUIRES: OS=windows-msvc

// This file has CRT-specific C stdlib tests, that use
// some APIs present only in CRT.

import CRT

func complexFunctionsAvailableInSwift() {
let complexValue = _Cbuild(1.0, 2.0) // Construct a complex double using MSVC-specific API.
let _ = creal(complexValue)
}