Skip to content

How do I use llvm::Function through Swift bindings? #33

@WowbaggersLiquidLunch

Description

@WowbaggersLiquidLunch

Apologies if I'm asking on the wrong place, because it's maybe more of a C++ inter-op question.

I'm trying to use llvm::Function through LLVM_Utils and/or LLVM_IR. Xcode's auto-completion shows this, which is confusing to me:

image

Then, when I try to build it, I get this error:

'Function' is not a member type of enum '__ObjC.llvm'

In the swift-llvm-bindings source is this line:

https://github.com/apple/swift-llvm-bindings/blob/b9b825218a945e450cbaf740a980284b323e09ca/Sources/LLVM/LLVM_Utils.swift#L58

Both Twine and Function are classes declared in the llvm namespace. The only difference is the LLVM_EXTERNAL_VISIBILITY macro for Function, but it expands to just [[gnu::visibility("default")]] on macOS.

Why does llvm.Twine work, but not llvm.Function? What should I do to make llvm.Function work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions