{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift/pulls/comments/173687096","pull_request_review_id":102914984,"id":173687096,"diff_hunk":"@@ -278,8 +278,14 @@ void Lexer::formToken(tok Kind, const char *TokStart, bool MultilineString) {\n     Kind = tok::eof;\n   }\n   unsigned CommentLength = 0;\n-  if (RetainComments == CommentRetentionMode::AttachToNextToken && SeenComment)\n-    CommentLength = TokStart - LastCommentBlockStart;\n+  if (RetainComments == CommentRetentionMode::AttachToNextToken) {\n+    auto FirstCommentIter = std::find_if(\n+        LeadingTrivia.begin(), LeadingTrivia.end(),\n+        [](const TriviaPiece &Piece) { return Piece.isComment(); });\n+    for (auto Iter = FirstCommentIter; Iter != LeadingTrivia.end(); Iter++) {","path":"lib/Parse/Lexer.cpp","position":10,"original_position":10,"commit_id":"2c58cfda88d94f5e005baeb76f3778ee12147b75","original_commit_id":"2c58cfda88d94f5e005baeb76f3778ee12147b75","user":{"login":"rintaro","id":142081,"avatar_url":"https://avatars1.githubusercontent.com/u/142081?v=4","gravatar_id":"","url":"https://api.github.com/users/rintaro","html_url":"https://github.com/rintaro","followers_url":"https://api.github.com/users/rintaro/followers","following_url":"https://api.github.com/users/rintaro/following{/other_user}","gists_url":"https://api.github.com/users/rintaro/gists{/gist_id}","starred_url":"https://api.github.com/users/rintaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rintaro/subscriptions","organizations_url":"https://api.github.com/users/rintaro/orgs","repos_url":"https://api.github.com/users/rintaro/repos","events_url":"https://api.github.com/users/rintaro/events{/privacy}","received_events_url":"https://api.github.com/users/rintaro/received_events","type":"User","site_admin":false},"body":"Small code style request:\r\n```cpp\r\n    auto Iter = ...;\r\n    for (auto End = LeadingTrivia.end(); Iter != End; ++Iter) {\r\n```\r\n\r\nAlso, try using [`llvm::find_if`](http://llvm.org/doxygen/STLExtras_8h_source.html) which accept a range instead of iterators.\r\n","created_at":"2018-03-12T03:09:26Z","updated_at":"2018-03-12T03:29:58Z","html_url":"https://github.com/apple/swift/pull/15152#discussion_r173687096","pull_request_url":"https://api.github.com/repos/apple/swift/pulls/15152","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/comments/173687096"},"html":{"href":"https://github.com/apple/swift/pull/15152#discussion_r173687096"},"pull_request":{"href":"https://api.github.com/repos/apple/swift/pulls/15152"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/15152","id":174208472,"html_url":"https://github.com/apple/swift/pull/15152","diff_url":"https://github.com/apple/swift/pull/15152.diff","patch_url":"https://github.com/apple/swift/pull/15152.patch","issue_url":"https://api.github.com/repos/apple/swift/issues/15152","number":15152,"state":"open","locked":false,"title":"[Parse] Remove unnecessary Lexer fields ","user":{"login":"omochi","id":312792,"avatar_url":"https://avatars0.githubusercontent.com/u/312792?v=4","gravatar_id":"","url":"https://api.github.com/users/omochi","html_url":"https://github.com/omochi","followers_url":"https://api.github.com/users/omochi/followers","following_url":"https://api.github.com/users/omochi/following{/other_user}","gists_url":"https://api.github.com/users/omochi/gists{/gist_id}","starred_url":"https://api.github.com/users/omochi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omochi/subscriptions","organizations_url":"https://api.github.com/users/omochi/orgs","repos_url":"https://api.github.com/users/omochi/repos","events_url":"https://api.github.com/users/omochi/events{/privacy}","received_events_url":"https://api.github.com/users/omochi/received_events","type":"User","site_admin":false},"body":"This PR removes Lexer fields which are `LastCommentBlockStart` and `SeenComment`.\r\nLexer tracks leading trivia always now.\r\nSo we can compute `CommentLength` from `LeadingTrivia`.\r\n\r\nIt can reduce Lexer's state handling and make code simple.","created_at":"2018-03-11T07:29:06Z","updated_at":"2018-03-12T03:29:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aae8316f5bb84d5915adf2ae7e146300a1bd662b","assignee":{"login":"rintaro","id":142081,"avatar_url":"https://avatars1.githubusercontent.com/u/142081?v=4","gravatar_id":"","url":"https://api.github.com/users/rintaro","html_url":"https://github.com/rintaro","followers_url":"https://api.github.com/users/rintaro/followers","following_url":"https://api.github.com/users/rintaro/following{/other_user}","gists_url":"https://api.github.com/users/rintaro/gists{/gist_id}","starred_url":"https://api.github.com/users/rintaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rintaro/subscriptions","organizations_url":"https://api.github.com/users/rintaro/orgs","repos_url":"https://api.github.com/users/rintaro/repos","events_url":"https://api.github.com/users/rintaro/events{/privacy}","received_events_url":"https://api.github.com/users/rintaro/received_events","type":"User","site_admin":false},"assignees":[{"login":"rintaro","id":142081,"avatar_url":"https://avatars1.githubusercontent.com/u/142081?v=4","gravatar_id":"","url":"https://api.github.com/users/rintaro","html_url":"https://github.com/rintaro","followers_url":"https://api.github.com/users/rintaro/followers","following_url":"https://api.github.com/users/rintaro/following{/other_user}","gists_url":"https://api.github.com/users/rintaro/gists{/gist_id}","starred_url":"https://api.github.com/users/rintaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rintaro/subscriptions","organizations_url":"https://api.github.com/users/rintaro/orgs","repos_url":"https://api.github.com/users/rintaro/repos","events_url":"https://api.github.com/users/rintaro/events{/privacy}","received_events_url":"https://api.github.com/users/rintaro/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift/pulls/15152/commits","review_comments_url":"https://api.github.com/repos/apple/swift/pulls/15152/comments","review_comment_url":"https://api.github.com/repos/apple/swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift/issues/15152/comments","statuses_url":"https://api.github.com/repos/apple/swift/statuses/2c58cfda88d94f5e005baeb76f3778ee12147b75","head":{"label":"omochi:lex-remove-fields","ref":"lex-remove-fields","sha":"2c58cfda88d94f5e005baeb76f3778ee12147b75","user":{"login":"omochi","id":312792,"avatar_url":"https://avatars0.githubusercontent.com/u/312792?v=4","gravatar_id":"","url":"https://api.github.com/users/omochi","html_url":"https://github.com/omochi","followers_url":"https://api.github.com/users/omochi/followers","following_url":"https://api.github.com/users/omochi/following{/other_user}","gists_url":"https://api.github.com/users/omochi/gists{/gist_id}","starred_url":"https://api.github.com/users/omochi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omochi/subscriptions","organizations_url":"https://api.github.com/users/omochi/orgs","repos_url":"https://api.github.com/users/omochi/repos","events_url":"https://api.github.com/users/omochi/events{/privacy}","received_events_url":"https://api.github.com/users/omochi/received_events","type":"User","site_admin":false},"repo":{"id":104282749,"name":"swift","full_name":"omochi/swift","owner":{"login":"omochi","id":312792,"avatar_url":"https://avatars0.githubusercontent.com/u/312792?v=4","gravatar_id":"","url":"https://api.github.com/users/omochi","html_url":"https://github.com/omochi","followers_url":"https://api.github.com/users/omochi/followers","following_url":"https://api.github.com/users/omochi/following{/other_user}","gists_url":"https://api.github.com/users/omochi/gists{/gist_id}","starred_url":"https://api.github.com/users/omochi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omochi/subscriptions","organizations_url":"https://api.github.com/users/omochi/orgs","repos_url":"https://api.github.com/users/omochi/repos","events_url":"https://api.github.com/users/omochi/events{/privacy}","received_events_url":"https://api.github.com/users/omochi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/omochi/swift","description":"The Swift Programming Language","fork":true,"url":"https://api.github.com/repos/omochi/swift","forks_url":"https://api.github.com/repos/omochi/swift/forks","keys_url":"https://api.github.com/repos/omochi/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/omochi/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/omochi/swift/teams","hooks_url":"https://api.github.com/repos/omochi/swift/hooks","issue_events_url":"https://api.github.com/repos/omochi/swift/issues/events{/number}","events_url":"https://api.github.com/repos/omochi/swift/events","assignees_url":"https://api.github.com/repos/omochi/swift/assignees{/user}","branches_url":"https://api.github.com/repos/omochi/swift/branches{/branch}","tags_url":"https://api.github.com/repos/omochi/swift/tags","blobs_url":"https://api.github.com/repos/omochi/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/omochi/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/omochi/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/omochi/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/omochi/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/omochi/swift/languages","stargazers_url":"https://api.github.com/repos/omochi/swift/stargazers","contributors_url":"https://api.github.com/repos/omochi/swift/contributors","subscribers_url":"https://api.github.com/repos/omochi/swift/subscribers","subscription_url":"https://api.github.com/repos/omochi/swift/subscription","commits_url":"https://api.github.com/repos/omochi/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/omochi/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/omochi/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/omochi/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/omochi/swift/contents/{+path}","compare_url":"https://api.github.com/repos/omochi/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/omochi/swift/merges","archive_url":"https://api.github.com/repos/omochi/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/omochi/swift/downloads","issues_url":"https://api.github.com/repos/omochi/swift/issues{/number}","pulls_url":"https://api.github.com/repos/omochi/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/omochi/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/omochi/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/omochi/swift/labels{/name}","releases_url":"https://api.github.com/repos/omochi/swift/releases{/id}","deployments_url":"https://api.github.com/repos/omochi/swift/deployments","created_at":"2017-09-21T00:41:52Z","updated_at":"2017-09-21T06:03:51Z","pushed_at":"2018-03-11T15:13:24Z","git_url":"git://github.com/omochi/swift.git","ssh_url":"git@github.com:omochi/swift.git","clone_url":"https://github.com/omochi/swift.git","svn_url":"https://github.com/omochi/swift","homepage":"https://swift.org/","size":264403,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"12b0987d8e229c05186ee000550479b21f827134","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":44838949,"name":"swift","full_name":"apple/swift","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift","description":"The Swift Programming Language","fork":false,"url":"https://api.github.com/repos/apple/swift","forks_url":"https://api.github.com/repos/apple/swift/forks","keys_url":"https://api.github.com/repos/apple/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift/teams","hooks_url":"https://api.github.com/repos/apple/swift/hooks","issue_events_url":"https://api.github.com/repos/apple/swift/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift/events","assignees_url":"https://api.github.com/repos/apple/swift/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift/tags","blobs_url":"https://api.github.com/repos/apple/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift/languages","stargazers_url":"https://api.github.com/repos/apple/swift/stargazers","contributors_url":"https://api.github.com/repos/apple/swift/contributors","subscribers_url":"https://api.github.com/repos/apple/swift/subscribers","subscription_url":"https://api.github.com/repos/apple/swift/subscription","commits_url":"https://api.github.com/repos/apple/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift/merges","archive_url":"https://api.github.com/repos/apple/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift/downloads","issues_url":"https://api.github.com/repos/apple/swift/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift/deployments","created_at":"2015-10-23T21:15:07Z","updated_at":"2018-03-12T02:54:49Z","pushed_at":"2018-03-12T02:58:40Z","git_url":"git://github.com/apple/swift.git","ssh_url":"git@github.com:apple/swift.git","clone_url":"https://github.com/apple/swift.git","svn_url":"https://github.com/apple/swift","homepage":"https://swift.org/","size":270862,"stargazers_count":42926,"watchers_count":42926,"language":"C++","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6759,"mirror_url":null,"archived":false,"open_issues_count":292,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":6759,"open_issues":292,"watchers":42926,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/15152"},"html":{"href":"https://github.com/apple/swift/pull/15152"},"issue":{"href":"https://api.github.com/repos/apple/swift/issues/15152"},"comments":{"href":"https://api.github.com/repos/apple/swift/issues/15152/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift/pulls/15152/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift/pulls/15152/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift/statuses/2c58cfda88d94f5e005baeb76f3778ee12147b75"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rintaro"}}