Commit Graph

1990 Commits

Author SHA1 Message Date
swift-ci
ce0f17aeac Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 21:35:40 -07:00
Henrik G. Olsson
7fcc72f108 Merge pull request #81859 from swiftlang/swiftify-inherit-imports
[MacrosOnImports][Swiftify] Copy module imports from clang node's module to its Swift macro SourceFile
2025-09-19 21:21:09 -07:00
Adrian Prantl
bb69a28b3d Merge pull request #84351 from adrian-prantl/rebranch-fulldebug
ClangImporter: Only force full debug info when DebuggerSupport is ena…
2025-09-17 14:22:05 -07:00
Adrian Prantl
b576aeea3b ClangImporter: Only force full debug info when DebuggerSupport is enabled 2025-09-17 09:37:50 -07:00
Henrik G. Olsson
0276febf41 handle libc++ v17-19
libc++ v17-19 was split into multiple top-level modules, while versions
earlier and later had one TLM with submodules.
2025-09-16 21:10:09 -07:00
Henrik G. Olsson
120c7de56b [ClangImporter] Fix CxxStdlib submodule names in swift interface
A previous commit resulted in the swift interface for CxxStdlib
containing an `import CxxStdlib` for each submodule. This restores the
submodule names to `CxxStdlib.vector` etc.
2025-09-16 21:10:09 -07:00
Henrik G. Olsson
369fc18c01 [ClangImporter] Only import explicit submodules to the current module
Non-explicit submodules don't need to be explicitly added to the list of
imports to be visible, since their decls are implicitly exported. Skip
these modules even when present in the list of imports. Explicit
submodules are imported *regardless* of whether another module
imports them however.
2025-09-16 21:10:04 -07:00
Henrik G. Olsson
c80b6f682c [ClangImporter] Only copy submodule imports for top-level modules
Since only top-level Swift modules ever contain code, setting imports
for submodule wrappers has no effect.
2025-09-16 21:10:04 -07:00
Henrik G. Olsson
928cc6c83e [ClangImporter] Deduplicate imports copied from submodule to TLM
The imported top-level module inherits the imports of all its
(transitive) submodules. Since multiple submodules can import the same
modules these need to be deduplicated to avoid redundant work.
2025-09-16 21:10:03 -07:00
swift-ci
b08d731e34 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-16 19:16:11 -07:00
susmonteiro
2640c71ec0 [cxx-interop] Refactor copyability out of CxxRecordSemantics 2025-09-16 14:40:16 +01:00
Adrian Prantl
b36c9f89d5 [ClangImporter] Set the debug info level to full debug info.
Upstream clang has introduced a new default level for Linux that sits
between no debug info and full debug info.
2025-09-10 16:49:05 -07:00
Adrian Prantl
a1cb24ee39 Merge pull request #84094 from adrian-prantl/repl-debug-info
Unconditionally enable debug info in ClangImporter when DebuggerSuppo…
2025-09-08 18:51:25 -07:00
Henrik G. Olsson
13b1faf471 [ClangImporter] Add submodules as implicit imports of wrapper module
Decls in Swift wrapper module may not originate in the top-level clang
module with the same name, since decls in clang submodules are dumped
into the top-level module. This is because Swift has no concept of
submodules. To make sure that any imported decl has access to the same
symbols as the original clang decl had, all transitive submodules, and
their imports, are added as implicit imports of the wrapper module. This
is necessary in the case where a submodule is marked `explicit`.

The content in explicit submodules isn't normally made visible when
importing the parent module. Decls from explicit submodules still
end up in the top-level wrapper module however, so in Swift they do
still need to be visible from the top-level module. This is relevant
for macro expansions, so that they can refer to the same types as the
original decl.
2025-09-08 17:25:35 -07:00
Henrik G. Olsson
5394d68b6c fix dangling StringRef 2025-09-08 17:25:31 -07:00
Henrik G. Olsson
f4991cc0b6 fix implicit import of CxxStd module 2025-09-08 17:25:30 -07:00
Henrik G. Olsson
a43c8474bc [ClangImporter] Add clang module imports to Swift wrapper module
When macros like _SwiftifyImport are added to a wrapper module for a
clang module, they may need to refer to symbols declared in another
clang module that the wrapped module imports (e.g. because they are used
in the original signature). This adds all the imported clang modules as
implicit imports to the wrapper module.

rdar://151611573
2025-09-08 17:25:26 -07:00
swift-ci
99d1e61dc1 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-05 12:18:29 -07:00
Susana Monteiro
cd01e914fa Merge pull request #84121 from susmonteiro/susmonteiro/copy-operations-requires-clause
[cxx-interop] Check if copy constructor is eligible
2025-09-05 17:40:06 +01:00
susmonteiro
96d00189e7 [cxx-interop] Check if copy constructor is eligible 2025-09-04 22:09:42 +01:00
Anthony Latsis
e1450e011e Manually merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
*	utils/build_swift/build_swift/defaults.py
2025-09-04 14:07:50 +01:00
Ahmed Elrefaey
1bc96857a8 Merge pull request #82464 from a7medev/feat/full-documentation-in-code-completion
[IDE] Add full documentation to code completion result
2025-09-04 10:06:21 +01:00
Adrian Prantl
301a2e21c3 Unconditionally enable debug info in ClangImporter when DebuggerSupport is requested 2025-09-03 15:42:21 -07:00
swift-ci
94f8b0d0e3 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-25 17:03:36 -07:00
fahadnayyar
720406fdd6 Diagnose unannotated C++ APIs returning SWIFT_SHARED_REFERENCE at Swift call sites (#83025)
This patch improves the warning for C++ APIs returning
`SWIFT_SHARED_REFERENCE` types but not annotated with either
`SWIFT_RETURNS_RETAINED` or `SWIFT_RETURNS_UNRETAINED` in the following
ways:

1. The warning for missing `SWIFT_RETURNS_(UN)RETAINED` annotations is
now emitted on Swift use sites, rather than while importing the API
(func/method decls).
- This logic is now implemented as a Misl Diagnostic in function
`diagnoseCxxFunctionCalls` in file lib/Sema/MiscDiagnostics.cpp.
- The warning is now triggered only when the API is actually used, which
reduces noise in large C++ headers.
- These warnings are still gated behind experimental-feature-flag `WarnUnannotatedReturnOfCxxFrt`

rdar://150800115
2025-08-25 14:44:25 -07:00
swift-ci
ab9176fa4b Merge remote-tracking branch 'origin/main' into rebranch 2025-08-16 02:24:41 -07:00
Allan Shortlidge
678b0934d6 AST: Request-ify getting the AvailabilityDomain from a ValueDecl.
Cache the result of turning a `ValueDecl` into an `AvailabilityDomain`. Use
split caching to make the common case of the decl not representing an
availability domain efficient.

NFC.
2025-08-15 16:15:36 -07:00
swift-ci
c0223fb423 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-15 12:15:24 -07:00
Egor Zhdan
f96a5e5b2b Merge pull request #83589 from egorzhdan/egorzhdan/reland-extern-namespace
Revert "Revert "[cxx-interop] Import decls in extern blocks within namespaces""
2025-08-15 18:30:51 +01:00
swift-ci
fdc5b2bc73 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 19:55:30 -07:00
Allan Shortlidge
0bba9bbc26 AST: Make the decl associated with an AvailabilityDomain a ValueDecl.
A decl that represents an `AvailabilityDomain` should always be a `ValueDecl`.
2025-08-14 11:35:00 -07:00
swift-ci
a06b4d6144 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-07 23:17:13 -07:00
Gábor Horváth
35b5c817b2 Merge pull request #83520 from Xazax-hun/check-safety-function-types 2025-08-08 06:39:39 +01:00
swift-ci
900afabfe1 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-07 07:43:32 -07:00
Egor Zhdan
a5b4975204 Revert "Revert "[cxx-interop] Import decls in extern blocks within namespaces""
This reverts commit 8f60840551.
2025-08-07 15:03:08 +01:00
Gábor Horváth
91b4fabca1 Merge pull request #83542 from Xazax-hun/simd-is-escapable
[cxx-interop] Handle vector types in escapability analysis
2025-08-07 12:40:40 +01:00
swift-ci
e50230f935 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-06 22:35:25 -07:00
Allan Shortlidge
8f60840551 Revert "[cxx-interop] Import decls in extern blocks within namespaces"
This reverts commit 844787fddb.
2025-08-06 21:50:55 -07:00
swift-ci
43b83de02e Merge remote-tracking branch 'origin/main' into rebranch 2025-08-06 04:34:26 -07:00
Egor Zhdan
4adccbdd90 Merge pull request #83516 from egorzhdan/egorzhdan/extern-within-namespace
[cxx-interop] Import decls in extern blocks within namespaces
2025-08-06 12:27:45 +01:00
Gabor Horvath
c8f8e863f9 [cxx-interop] Handle vector types in escapability analysis
Whenever we have a vector type, the escpability depends on the
escapability of the element type. This will enable us to consider more
types like std::vector<simd::float3> as safe by default.

rdar://157141552
2025-08-05 14:55:33 +01:00
Anthony Latsis
eaafb0ed7e Manually merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
- lib/ClangImporter/ClangImporter.cpp
2025-08-05 14:24:07 +01:00
Gabor Horvath
402ad33463 [StrictMemorySafety] Check the safety of return types of calls
Previously, we skipped checking the return type of a function for safety
as we expected to warn at the use of the returned value:

  let x = returnsUnsafe()
  usesUnsafe(x) // warn here

Unfortunately, this resulted in missing some unsafe constructs that can
introduce memory safety issues when the use of the return value had a
different shape resulting in false negatives for cases like:

  return returnsUnsafe()

or

  usesUnsafe(returnsUnsafe())

This PR changes the analysis to always take return types of function
calls into account.

rdar://157237301
2025-08-05 12:16:44 +01:00
Egor Zhdan
844787fddb [cxx-interop] Import decls in extern blocks within namespaces
This teaches ClangImporter to import C++ decls that are declared within `extern "C" { ... }`/`extern "C++" { ... }` blocks which are nested in namespaces.

rdar://139067788
2025-08-04 19:42:43 +01:00
Adrian Prantl
e690f1d6c4 Merge pull request #83415 from adrian-prantl/157063577
[ClangImporter] Allow LLDB to prefer serialized bridging headers.
2025-08-04 11:09:39 -07:00
Adrian Prantl
a6678476d8 [ClangImporter] Prefer serialized bridging headers in LLDB.
Especially in an explicit modules project, LLDB might not know all the
search paths needed to imported the on disk header.

rdar://157063577
2025-08-01 10:20:27 -07:00
swift-ci
3998a187f9 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-30 09:36:41 -07:00
Anthony Latsis
bbd84429a0 Merge pull request #83400 from swiftlang/jepa-main
Address `llvm::PointerUnion::{is,get}` deprecations
2025-07-30 17:19:58 +01:00
Anthony Latsis
3f841b515c Merge remote-tracking branch 'origin/main' into jepa-rebranch 2025-07-30 14:31:33 +01:00
Egor Zhdan
9bc16e3dc0 Merge pull request #83402 from egorzhdan/egorzhdan/honor-non-copyable-attr
[cxx-interop] Avoid trying to instantiate copy constructors of explicitly non-copyable structs
2025-07-30 12:16:54 +01:00