swiftlang / swiftlang/swift

C++ types declared within unimportable type are not imported

Open
#60,005 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug c++ interop
Dominant language
Swift
Stars
70.4k
Forks
10.8k
PR merge metrics
PR metrics pending

Description

The MLIRContext C++ type is not imported into Swift by default, because is has a deleted copy constructor: https://github.com/llvm/llvm-project/blob/f0cd5389850589fbf8a3ce77cea2539579bd8028/mlir/include/mlir/IR/MLIRContext.h#L55

However, another type (Threading) declared within MLIRContext is not imported, even though there is nothing preventing Swift from importing it.
https://github.com/llvm/llvm-project/blob/f0cd5389850589fbf8a3ce77cea2539579bd8028/mlir/include/mlir/IR/MLIRContext.h#L57

Can Swift treat MLIRContext as a namespace in this case, importing it as an enum with no cases?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked MLIRContext.h declaration and trace the Swift C++ importer’s handling of nested types whose enclosing C++ type is not imported. Determine the relevant importer test area, then define regression coverage for importing Threading without importing MLIRContext itself.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, swift
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.