forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clang importer: introduce "importFullName" to centralize name-mapping…
… logic. The Swift lookup tables are the primary client and test vehicle right now. This change adds the capability to use the swift_name attribute to rename C functions when they are imported into Swift, as well as handling the swift_private attribute more uniformly. There are a few obvious places where I've applied this API to eliminate redundancy. Expect it to broaden as the API fills out more.
- Loading branch information
1 parent
c2bf16c
commit a861a73
Showing
5 changed files
with
231 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
#define SWIFT_NAME(X) __attribute__((swift_name(#X))) | ||
|
||
// Renaming global variables. | ||
int SNFoo SWIFT_NAME(Bar); | ||
|
||
// Renaming tags and fields. | ||
struct SWIFT_NAME(SomeStruct) SNSomeStruct { | ||
double X SWIFT_NAME(x); | ||
}; | ||
|
||
// Renaming C functions | ||
struct SNSomeStruct SNMakeSomeStruct(double X, double Y) SWIFT_NAME(makeSomeStruct(x:y:)); | ||
|
||
struct SNSomeStruct SNMakeSomeStructForX(double X) SWIFT_NAME(makeSomeStruct(x:)); | ||
|
||
// swift_private attribute | ||
void SNTransposeInPlace(struct SNSomeStruct *value) __attribute__((swift_private)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters