HomePhabricator

[Swift] Extend swift_name attribute to describe members.
3d7dd666a38eUnpublished

Authored by doug.gregor on Mar 1 2016, 9:05 AM.

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

[Swift] Extend swift_name attribute to describe members.

Extend the syntax of the swift_name string to allow "Foo.bar", which
specifies that the entity to which the attribute appertains should be
imported as a member named "foo" of the type with the Swift name
"Foo".

For functions that will become instance methods, the special argument
name "self" indicates which parameter of the C function will become
the "self" parameter. For example, given:

typedef struct __attribute__(((swift_name("Foo"))) AAFoo {
  /* ... */
} AAFoo;

void AAFooDoSomething(AAFoo foo, double x, double y)
  __attribute__((swift_name("Foo.doSomething(self:x:y:)")));

The C type AAFoo will be imported as the Swift type Foo, and
AAFooDoSomething will be imported as an instance method
"doSomething(x:y:)" of Foo, where the first parameter is "self".

Part of implementing SE-0033.

apple-llvm-split-commit: 864a33392056d76af17f5d955b6082a94b8ea99a
apple-llvm-split-dir: clang/

Details

Committed
doug.gregorMar 1 2016, 9:05 AM
Parents
rG17dfe2e87cec: Propagating prior merge from 'llvm.org/master'.
Branches
Unknown
Tags
Unknown