{"action":"created","comment":{"url":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments/57521002","id":57521002,"diff_hunk":"@@ -202,3 +211,33 @@ void applyFuncDeclUDAs(FuncDeclaration *decl, llvm::Function *func) {\n     }\n   }\n }\n+\n+/// Checks whether 'sym' has the @ldc.attributes._weak() UDA applied.\n+bool hasWeakUDA(Dsymbol *sym) {\n+  if (!sym->userAttribDecl)\n+    return false;\n+\n+  // Loop over all UDAs and early return true if @weak was found.\n+  Expressions *attrs = sym->userAttribDecl->getAttributes();\n+  expandTuples(attrs);\n+  for (auto &attr : *attrs) {\n+    auto sle = getLdcAttributesStruct(attr);\n+    if (!sle)\n+      continue;\n+\n+    auto name = sle->sd->ident->string;\n+    if (name == attr::weak) {\n+        // Check whether @weak can be applied to this symbol.\n+        // Because hasWeakUDA is currently only called for global symbols, this check never errors.","path":"gen/uda.cpp","position":64,"original_position":64,"commit_id":"c4cbf09e2cc8e4573b2e8d48d0e8974c0cd0668c","original_commit_id":"c4cbf09e2cc8e4573b2e8d48d0e8974c0cd0668c","user":{"login":"klickverbot","id":19335,"avatar_url":"https://avatars.githubusercontent.com/u/19335?v=3","gravatar_id":"","url":"https://api.github.com/users/klickverbot","html_url":"https://github.com/klickverbot","followers_url":"https://api.github.com/users/klickverbot/followers","following_url":"https://api.github.com/users/klickverbot/following{/other_user}","gists_url":"https://api.github.com/users/klickverbot/gists{/gist_id}","starred_url":"https://api.github.com/users/klickverbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klickverbot/subscriptions","organizations_url":"https://api.github.com/users/klickverbot/orgs","repos_url":"https://api.github.com/users/klickverbot/repos","events_url":"https://api.github.com/users/klickverbot/events{/privacy}","received_events_url":"https://api.github.com/users/klickverbot/received_events","type":"User","site_admin":false},"body":"Shouldn't the check rather be moved to `apply{Func, Var}DeclUDAs`, where you even already have a branch for `@weak`?","created_at":"2016-03-26T23:43:09Z","updated_at":"2016-03-26T23:43:09Z","html_url":"https://github.com/ldc-developers/ldc/pull/1378#discussion_r57521002","pull_request_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378","_links":{"self":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments/57521002"},"html":{"href":"https://github.com/ldc-developers/ldc/pull/1378#discussion_r57521002"},"pull_request":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378"}}},"pull_request":{"url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378","id":63796590,"html_url":"https://github.com/ldc-developers/ldc/pull/1378","diff_url":"https://github.com/ldc-developers/ldc/pull/1378.diff","patch_url":"https://github.com/ldc-developers/ldc/pull/1378.patch","issue_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1378","number":1378,"state":"open","locked":false,"title":"Add the @ldc.attributes.weak linkage attribute for global symbols.","user":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"body":"Implements #1376 .\r\n\r\nI did not know how to best implement a UDA syntax `@weak` without using a `struct _weak` and `alias weak = _weak()`. I thought `@weak()` would be ugly, but I have no strong opinion on this. Please advise on naming :)\r\n","created_at":"2016-03-22T21:31:36Z","updated_at":"2016-03-26T23:43:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d85a8207f94bc6ed51f9fa7db4d5984fa6122ac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378/commits","review_comments_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378/comments","review_comment_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1378/comments","statuses_url":"https://api.github.com/repos/ldc-developers/ldc/statuses/c4cbf09e2cc8e4573b2e8d48d0e8974c0cd0668c","head":{"label":"JohanEngelen:weaklink","ref":"weaklink","sha":"c4cbf09e2cc8e4573b2e8d48d0e8974c0cd0668c","user":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"repo":{"id":31165992,"name":"ldc","full_name":"JohanEngelen/ldc","owner":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JohanEngelen/ldc","description":"The LLVM-based D compiler.","fork":true,"url":"https://api.github.com/repos/JohanEngelen/ldc","forks_url":"https://api.github.com/repos/JohanEngelen/ldc/forks","keys_url":"https://api.github.com/repos/JohanEngelen/ldc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JohanEngelen/ldc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JohanEngelen/ldc/teams","hooks_url":"https://api.github.com/repos/JohanEngelen/ldc/hooks","issue_events_url":"https://api.github.com/repos/JohanEngelen/ldc/issues/events{/number}","events_url":"https://api.github.com/repos/JohanEngelen/ldc/events","assignees_url":"https://api.github.com/repos/JohanEngelen/ldc/assignees{/user}","branches_url":"https://api.github.com/repos/JohanEngelen/ldc/branches{/branch}","tags_url":"https://api.github.com/repos/JohanEngelen/ldc/tags","blobs_url":"https://api.github.com/repos/JohanEngelen/ldc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JohanEngelen/ldc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JohanEngelen/ldc/git/refs{/sha}","trees_url":"https://api.github.com/repos/JohanEngelen/ldc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JohanEngelen/ldc/statuses/{sha}","languages_url":"https://api.github.com/repos/JohanEngelen/ldc/languages","stargazers_url":"https://api.github.com/repos/JohanEngelen/ldc/stargazers","contributors_url":"https://api.github.com/repos/JohanEngelen/ldc/contributors","subscribers_url":"https://api.github.com/repos/JohanEngelen/ldc/subscribers","subscription_url":"https://api.github.com/repos/JohanEngelen/ldc/subscription","commits_url":"https://api.github.com/repos/JohanEngelen/ldc/commits{/sha}","git_commits_url":"https://api.github.com/repos/JohanEngelen/ldc/git/commits{/sha}","comments_url":"https://api.github.com/repos/JohanEngelen/ldc/comments{/number}","issue_comment_url":"https://api.github.com/repos/JohanEngelen/ldc/issues/comments{/number}","contents_url":"https://api.github.com/repos/JohanEngelen/ldc/contents/{+path}","compare_url":"https://api.github.com/repos/JohanEngelen/ldc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JohanEngelen/ldc/merges","archive_url":"https://api.github.com/repos/JohanEngelen/ldc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JohanEngelen/ldc/downloads","issues_url":"https://api.github.com/repos/JohanEngelen/ldc/issues{/number}","pulls_url":"https://api.github.com/repos/JohanEngelen/ldc/pulls{/number}","milestones_url":"https://api.github.com/repos/JohanEngelen/ldc/milestones{/number}","notifications_url":"https://api.github.com/repos/JohanEngelen/ldc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JohanEngelen/ldc/labels{/name}","releases_url":"https://api.github.com/repos/JohanEngelen/ldc/releases{/id}","deployments_url":"https://api.github.com/repos/JohanEngelen/ldc/deployments","created_at":"2015-02-22T14:46:29Z","updated_at":"2016-02-23T09:01:52Z","pushed_at":"2016-03-26T20:33:35Z","git_url":"git://github.com/JohanEngelen/ldc.git","ssh_url":"git@github.com:JohanEngelen/ldc.git","clone_url":"https://github.com/JohanEngelen/ldc.git","svn_url":"https://github.com/JohanEngelen/ldc","homepage":"http://wiki.dlang.org/LDC","size":23687,"stargazers_count":0,"watchers_count":0,"language":"D","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":0,"default_branch":"master"}},"base":{"label":"ldc-developers:ltsmaster","ref":"ltsmaster","sha":"8622120b2292bc93600c8d2b86bf664af8c4fa86","user":{"login":"ldc-developers","id":960112,"avatar_url":"https://avatars.githubusercontent.com/u/960112?v=3","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"repo":{"id":2174666,"name":"ldc","full_name":"ldc-developers/ldc","owner":{"login":"ldc-developers","id":960112,"avatar_url":"https://avatars.githubusercontent.com/u/960112?v=3","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ldc-developers/ldc","description":"The LLVM-based D compiler.","fork":false,"url":"https://api.github.com/repos/ldc-developers/ldc","forks_url":"https://api.github.com/repos/ldc-developers/ldc/forks","keys_url":"https://api.github.com/repos/ldc-developers/ldc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ldc-developers/ldc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ldc-developers/ldc/teams","hooks_url":"https://api.github.com/repos/ldc-developers/ldc/hooks","issue_events_url":"https://api.github.com/repos/ldc-developers/ldc/issues/events{/number}","events_url":"https://api.github.com/repos/ldc-developers/ldc/events","assignees_url":"https://api.github.com/repos/ldc-developers/ldc/assignees{/user}","branches_url":"https://api.github.com/repos/ldc-developers/ldc/branches{/branch}","tags_url":"https://api.github.com/repos/ldc-developers/ldc/tags","blobs_url":"https://api.github.com/repos/ldc-developers/ldc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ldc-developers/ldc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ldc-developers/ldc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ldc-developers/ldc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ldc-developers/ldc/statuses/{sha}","languages_url":"https://api.github.com/repos/ldc-developers/ldc/languages","stargazers_url":"https://api.github.com/repos/ldc-developers/ldc/stargazers","contributors_url":"https://api.github.com/repos/ldc-developers/ldc/contributors","subscribers_url":"https://api.github.com/repos/ldc-developers/ldc/subscribers","subscription_url":"https://api.github.com/repos/ldc-developers/ldc/subscription","commits_url":"https://api.github.com/repos/ldc-developers/ldc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ldc-developers/ldc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ldc-developers/ldc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ldc-developers/ldc/contents/{+path}","compare_url":"https://api.github.com/repos/ldc-developers/ldc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ldc-developers/ldc/merges","archive_url":"https://api.github.com/repos/ldc-developers/ldc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ldc-developers/ldc/downloads","issues_url":"https://api.github.com/repos/ldc-developers/ldc/issues{/number}","pulls_url":"https://api.github.com/repos/ldc-developers/ldc/pulls{/number}","milestones_url":"https://api.github.com/repos/ldc-developers/ldc/milestones{/number}","notifications_url":"https://api.github.com/repos/ldc-developers/ldc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ldc-developers/ldc/labels{/name}","releases_url":"https://api.github.com/repos/ldc-developers/ldc/releases{/id}","deployments_url":"https://api.github.com/repos/ldc-developers/ldc/deployments","created_at":"2011-08-08T17:10:27Z","updated_at":"2016-03-23T16:03:04Z","pushed_at":"2016-03-26T21:50:13Z","git_url":"git://github.com/ldc-developers/ldc.git","ssh_url":"git@github.com:ldc-developers/ldc.git","clone_url":"https://github.com/ldc-developers/ldc.git","svn_url":"https://github.com/ldc-developers/ldc","homepage":"http://wiki.dlang.org/LDC","size":24891,"stargazers_count":439,"watchers_count":439,"language":"D","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":92,"mirror_url":null,"open_issues_count":168,"forks":92,"open_issues":168,"watchers":439,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378"},"html":{"href":"https://github.com/ldc-developers/ldc/pull/1378"},"issue":{"href":"https://api.github.com/repos/ldc-developers/ldc/issues/1378"},"comments":{"href":"https://api.github.com/repos/ldc-developers/ldc/issues/1378/comments"},"review_comments":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378/comments"},"review_comment":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1378/commits"},"statuses":{"href":"https://api.github.com/repos/ldc-developers/ldc/statuses/c4cbf09e2cc8e4573b2e8d48d0e8974c0cd0668c"}}}}