{"action":"created","comment":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/comments/23750703","id":23750703,"diff_hunk":"@@ -0,0 +1,138 @@\n+\n+/* Compiler implementation of the D programming language\n+ * Copyright (c) 2015 by Digital Mars\n+ * All Rights Reserved\n+ * written by Michel Fortin\n+ * http://www.digitalmars.com\n+ * Distributed under the Boost Software License, Version 1.0.\n+ * http://www.boost.org/LICENSE_1_0.txt\n+ * https://github.com/D-Programming-Language/dmd/blob/master/src/objc.h\n+ */\n+\n+#ifndef DMD_OBJC_H\n+#define DMD_OBJC_H\n+\n+#include \"root.h\"\n+#include \"mtype.h\"\n+#include \"stringtable.h\"\n+\n+#include \"objc_glue.h\"\n+\n+class Identifier;\n+class FuncDeclaration;\n+class ClassDeclaration;\n+class InterfaceDeclaration;\n+class ObjcSelector;\n+\n+struct elem;","path":"src/objc.h","position":27,"original_position":27,"commit_id":"09b3980f345387528c0189fb2162eeccbc4e135f","original_commit_id":"09b3980f345387528c0189fb2162eeccbc4e135f","user":{"login":"jacob-carlborg","id":306980,"avatar_url":"https://avatars.githubusercontent.com/u/306980?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob-carlborg","html_url":"https://github.com/jacob-carlborg","followers_url":"https://api.github.com/users/jacob-carlborg/followers","following_url":"https://api.github.com/users/jacob-carlborg/following{/other_user}","gists_url":"https://api.github.com/users/jacob-carlborg/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob-carlborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob-carlborg/subscriptions","organizations_url":"https://api.github.com/users/jacob-carlborg/orgs","repos_url":"https://api.github.com/users/jacob-carlborg/repos","events_url":"https://api.github.com/users/jacob-carlborg/events{/privacy}","received_events_url":"https://api.github.com/users/jacob-carlborg/received_events","type":"User","site_admin":false},"body":"So basically calling `ObjcSymbols::getMethVarRef` from `objc_callfunc_setupMethodSelector`? In the full implementation it's called from three places. Perhaps not a big deal.","created_at":"2015-01-29T07:31:23Z","updated_at":"2015-01-29T07:31:23Z","html_url":"https://github.com/D-Programming-Language/dmd/pull/4321#discussion_r23750703","pull_request_url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321","_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/comments/23750703"},"html":{"href":"https://github.com/D-Programming-Language/dmd/pull/4321#discussion_r23750703"},"pull_request":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321"}}},"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321","id":27710786,"html_url":"https://github.com/D-Programming-Language/dmd/pull/4321","diff_url":"https://github.com/D-Programming-Language/dmd/pull/4321.diff","patch_url":"https://github.com/D-Programming-Language/dmd/pull/4321.patch","issue_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/4321","number":4321,"state":"open","locked":false,"title":"Implement basic support for Objective-C methods.","user":{"login":"jacob-carlborg","id":306980,"avatar_url":"https://avatars.githubusercontent.com/u/306980?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob-carlborg","html_url":"https://github.com/jacob-carlborg","followers_url":"https://api.github.com/users/jacob-carlborg/followers","following_url":"https://api.github.com/users/jacob-carlborg/following{/other_user}","gists_url":"https://api.github.com/users/jacob-carlborg/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob-carlborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob-carlborg/subscriptions","organizations_url":"https://api.github.com/users/jacob-carlborg/orgs","repos_url":"https://api.github.com/users/jacob-carlborg/repos","events_url":"https://api.github.com/users/jacob-carlborg/events{/privacy}","received_events_url":"https://api.github.com/users/jacob-carlborg/received_events","type":"User","site_admin":false},"body":"Some return types does not work, those are: `long double`, `_Complex long double` and structs that are too large to fit in registers. The runtime part of this pull is in https://github.com/D-Programming-Language/druntime/pull/1111.\r\n\r\nThe below text is in the commit message as well. I don't know if it's too long for a commit message or if there's a better place to document this.\r\n\r\nBasic support for classes, interfaces and instance methods.\r\nThis is implemented by adding a new linkage attribute, `Objective-C`,\r\nand a compiler recognized UDA, `@selector`. The linkage attribute is\r\nto be used on a class or interface. The UDA is attached to a method.\r\n\r\nThe linkage attribute tells the compiler that the class should use the\r\nname mangling that matches the one used by Objective-C\r\n(same as C, no mangling) and that all methods in the class\r\nshould use the Objective-C way of calling methods, see below.\r\nThe calling convention for Objective-C methods and functions is the\r\nsame as for C.\r\n\r\nThe selector UDA tells the compiler what Objective-C selector the\r\nmethod should have. The selector is used in the Objective-C runtime\r\nto find the implementation of a given method.\r\n\r\nAn Objective-C method call is implemented by making a regular C call\r\nto the `objc_msgSend` function in the Objective-C runtime.\r\nThe signature of `objc_msgSend` looks something like this:\r\n\r\n`id objc_msgSend(id self, SEL op, ...);`\r\n\r\n* The first parameter is the object (this/self pointer)\r\n* The second parameter is the selector attached to the method\r\n* The last parameter is for all the arguments that the\r\nimplementation expects\r\n\r\nThe call to `objc_msgSend` should not be performed as a variadic\r\ncall but instead as if it had the same signature as the method\r\nthat should be called but with the two additional parameter,\r\n`self` and `op`, added first. The implementation of `objc_msgSend`\r\nwill jump to the method instead of calling it.\r\n\r\nBecause of the above, multiple versions exist of `objc_msgSend`.\r\nDepending on the return type of the method that is called the correct\r\nversion need to be used. This depends on the ABI. This is a list of\r\nfunctions and for which types they're used on OS X 64bit:\r\n\r\n* objc_msgSend_stret - Used for structs too large to be returned in\r\nregistries\r\n* objc_msgSend_fpret - Used for `long double`\r\n* objc_msgSend_fp2ret - Used for `_Complex long double`\r\n* objc_msgSend - Used for everything else","created_at":"2015-01-20T20:48:19Z","updated_at":"2015-01-29T07:31:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2706e6a14875c5e301ccf4dbd3a0621d80af1733","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321/commits","review_comments_url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321/comments","review_comment_url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/comments/{number}","comments_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/4321/comments","statuses_url":"https://api.github.com/repos/D-Programming-Language/dmd/statuses/09b3980f345387528c0189fb2162eeccbc4e135f","head":{"label":"jacob-carlborg:dobjc_instance_methods","ref":"dobjc_instance_methods","sha":"09b3980f345387528c0189fb2162eeccbc4e135f","user":{"login":"jacob-carlborg","id":306980,"avatar_url":"https://avatars.githubusercontent.com/u/306980?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob-carlborg","html_url":"https://github.com/jacob-carlborg","followers_url":"https://api.github.com/users/jacob-carlborg/followers","following_url":"https://api.github.com/users/jacob-carlborg/following{/other_user}","gists_url":"https://api.github.com/users/jacob-carlborg/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob-carlborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob-carlborg/subscriptions","organizations_url":"https://api.github.com/users/jacob-carlborg/orgs","repos_url":"https://api.github.com/users/jacob-carlborg/repos","events_url":"https://api.github.com/users/jacob-carlborg/events{/privacy}","received_events_url":"https://api.github.com/users/jacob-carlborg/received_events","type":"User","site_admin":false},"repo":{"id":3755857,"name":"dmd","full_name":"jacob-carlborg/dmd","owner":{"login":"jacob-carlborg","id":306980,"avatar_url":"https://avatars.githubusercontent.com/u/306980?v=3","gravatar_id":"","url":"https://api.github.com/users/jacob-carlborg","html_url":"https://github.com/jacob-carlborg","followers_url":"https://api.github.com/users/jacob-carlborg/followers","following_url":"https://api.github.com/users/jacob-carlborg/following{/other_user}","gists_url":"https://api.github.com/users/jacob-carlborg/gists{/gist_id}","starred_url":"https://api.github.com/users/jacob-carlborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacob-carlborg/subscriptions","organizations_url":"https://api.github.com/users/jacob-carlborg/orgs","repos_url":"https://api.github.com/users/jacob-carlborg/repos","events_url":"https://api.github.com/users/jacob-carlborg/events{/privacy}","received_events_url":"https://api.github.com/users/jacob-carlborg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jacob-carlborg/dmd","description":"dmd D Programming Language compiler","fork":true,"url":"https://api.github.com/repos/jacob-carlborg/dmd","forks_url":"https://api.github.com/repos/jacob-carlborg/dmd/forks","keys_url":"https://api.github.com/repos/jacob-carlborg/dmd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacob-carlborg/dmd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacob-carlborg/dmd/teams","hooks_url":"https://api.github.com/repos/jacob-carlborg/dmd/hooks","issue_events_url":"https://api.github.com/repos/jacob-carlborg/dmd/issues/events{/number}","events_url":"https://api.github.com/repos/jacob-carlborg/dmd/events","assignees_url":"https://api.github.com/repos/jacob-carlborg/dmd/assignees{/user}","branches_url":"https://api.github.com/repos/jacob-carlborg/dmd/branches{/branch}","tags_url":"https://api.github.com/repos/jacob-carlborg/dmd/tags","blobs_url":"https://api.github.com/repos/jacob-carlborg/dmd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacob-carlborg/dmd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacob-carlborg/dmd/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacob-carlborg/dmd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacob-carlborg/dmd/statuses/{sha}","languages_url":"https://api.github.com/repos/jacob-carlborg/dmd/languages","stargazers_url":"https://api.github.com/repos/jacob-carlborg/dmd/stargazers","contributors_url":"https://api.github.com/repos/jacob-carlborg/dmd/contributors","subscribers_url":"https://api.github.com/repos/jacob-carlborg/dmd/subscribers","subscription_url":"https://api.github.com/repos/jacob-carlborg/dmd/subscription","commits_url":"https://api.github.com/repos/jacob-carlborg/dmd/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacob-carlborg/dmd/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacob-carlborg/dmd/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacob-carlborg/dmd/issues/comments/{number}","contents_url":"https://api.github.com/repos/jacob-carlborg/dmd/contents/{+path}","compare_url":"https://api.github.com/repos/jacob-carlborg/dmd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacob-carlborg/dmd/merges","archive_url":"https://api.github.com/repos/jacob-carlborg/dmd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacob-carlborg/dmd/downloads","issues_url":"https://api.github.com/repos/jacob-carlborg/dmd/issues{/number}","pulls_url":"https://api.github.com/repos/jacob-carlborg/dmd/pulls{/number}","milestones_url":"https://api.github.com/repos/jacob-carlborg/dmd/milestones{/number}","notifications_url":"https://api.github.com/repos/jacob-carlborg/dmd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacob-carlborg/dmd/labels{/name}","releases_url":"https://api.github.com/repos/jacob-carlborg/dmd/releases{/id}","created_at":"2012-03-18T15:39:36Z","updated_at":"2015-01-11T19:21:45Z","pushed_at":"2015-01-23T20:36:47Z","git_url":"git://github.com/jacob-carlborg/dmd.git","ssh_url":"git@github.com:jacob-carlborg/dmd.git","clone_url":"https://github.com/jacob-carlborg/dmd.git","svn_url":"https://github.com/jacob-carlborg/dmd","homepage":"d-programming-language.org","size":46072,"stargazers_count":7,"watchers_count":7,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":7,"default_branch":"master"}},"base":{"label":"D-Programming-Language:master","ref":"master","sha":"4a8df52639d963f6278207e7aed694fc10861dc6","user":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"repo":{"id":1257070,"name":"dmd","full_name":"D-Programming-Language/dmd","owner":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/D-Programming-Language/dmd","description":"dmd D Programming Language compiler","fork":false,"url":"https://api.github.com/repos/D-Programming-Language/dmd","forks_url":"https://api.github.com/repos/D-Programming-Language/dmd/forks","keys_url":"https://api.github.com/repos/D-Programming-Language/dmd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/D-Programming-Language/dmd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/D-Programming-Language/dmd/teams","hooks_url":"https://api.github.com/repos/D-Programming-Language/dmd/hooks","issue_events_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/events{/number}","events_url":"https://api.github.com/repos/D-Programming-Language/dmd/events","assignees_url":"https://api.github.com/repos/D-Programming-Language/dmd/assignees{/user}","branches_url":"https://api.github.com/repos/D-Programming-Language/dmd/branches{/branch}","tags_url":"https://api.github.com/repos/D-Programming-Language/dmd/tags","blobs_url":"https://api.github.com/repos/D-Programming-Language/dmd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/D-Programming-Language/dmd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/D-Programming-Language/dmd/git/refs{/sha}","trees_url":"https://api.github.com/repos/D-Programming-Language/dmd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/D-Programming-Language/dmd/statuses/{sha}","languages_url":"https://api.github.com/repos/D-Programming-Language/dmd/languages","stargazers_url":"https://api.github.com/repos/D-Programming-Language/dmd/stargazers","contributors_url":"https://api.github.com/repos/D-Programming-Language/dmd/contributors","subscribers_url":"https://api.github.com/repos/D-Programming-Language/dmd/subscribers","subscription_url":"https://api.github.com/repos/D-Programming-Language/dmd/subscription","commits_url":"https://api.github.com/repos/D-Programming-Language/dmd/commits{/sha}","git_commits_url":"https://api.github.com/repos/D-Programming-Language/dmd/git/commits{/sha}","comments_url":"https://api.github.com/repos/D-Programming-Language/dmd/comments{/number}","issue_comment_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/comments/{number}","contents_url":"https://api.github.com/repos/D-Programming-Language/dmd/contents/{+path}","compare_url":"https://api.github.com/repos/D-Programming-Language/dmd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/D-Programming-Language/dmd/merges","archive_url":"https://api.github.com/repos/D-Programming-Language/dmd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/D-Programming-Language/dmd/downloads","issues_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues{/number}","pulls_url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls{/number}","milestones_url":"https://api.github.com/repos/D-Programming-Language/dmd/milestones{/number}","notifications_url":"https://api.github.com/repos/D-Programming-Language/dmd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/D-Programming-Language/dmd/labels{/name}","releases_url":"https://api.github.com/repos/D-Programming-Language/dmd/releases{/id}","created_at":"2011-01-15T06:53:53Z","updated_at":"2015-01-28T20:46:22Z","pushed_at":"2015-01-29T01:43:19Z","git_url":"git://github.com/D-Programming-Language/dmd.git","ssh_url":"git@github.com:D-Programming-Language/dmd.git","clone_url":"https://github.com/D-Programming-Language/dmd.git","svn_url":"https://github.com/D-Programming-Language/dmd","homepage":"dlang.org","size":82979,"stargazers_count":914,"watchers_count":914,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":293,"mirror_url":null,"open_issues_count":84,"forks":293,"open_issues":84,"watchers":914,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321"},"html":{"href":"https://github.com/D-Programming-Language/dmd/pull/4321"},"issue":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/issues/4321"},"comments":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/issues/4321/comments"},"review_comments":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321/comments"},"review_comment":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/4321/commits"},"statuses":{"href":"https://api.github.com/repos/D-Programming-Language/dmd/statuses/09b3980f345387528c0189fb2162eeccbc4e135f"}}}}