{"action":"created","comment":{"url":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/comments/202393304","pull_request_review_id":137089545,"id":202393304,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjM5MzMwNA==","diff_hunk":"@@ -2,20 +2,60 @@\n \n [![Build Status](https://travis-ci.org/bloomberg/clangmetatool.svg?branch=master)](https://travis-ci.org/bloomberg/clangmetatool)\n \n-The point of this library is to establish a framework for reusing code\n-in clang tools.\n+## About clangmetatool\n \n-Source control at [https://github.com/bloomberg/clangmetatool/](https://github.com/bloomberg/clangmetatool/)\n+When we first started writing clang tools, we realized that there is a\n+lot of life cycle management that we had to repeat. In some cases,\n+people advocate the usage of global variables to manage the lifecycle\n+of that data, but that makes code reuse across tools even harder.\n \n-## Building\n+Additionally, we also learned that when writing a tool, it will be\n+benefitial if the code is split in two phases. First a data collection\n+phase, and later a post-processing phase that actually performed the\n+bulk of the logic of the tool.\n \n-````bash\n-mkdir build\n-cd build\n-cmake -DClang_DIR=/path/to/clang/cmake ..\n-make\n-make install\n-````\n+Essentially you will only need to write a class like:\n+\n+```\n+class MyTool {\n+private:\n+  SomeDataCollector collector1;\n+  SomeOtherDataCollector collector2;\n+public:\n+  MyTool(clang::CompilerInstance* ci, clang::ast_matchers::MatchFinder *f)\n+   :collector1(ci, f), collector2(ci, f) {\n+   // the individual collectors will register their callbacks in their\n+   // constructor, the tool doesn't really need to do anything else here.\n+  }\n+  void postProcessing\n+  (std::map<std::string, clang::tooling::Replacements> &replacementsMap) {\n+   // use data from collector1 and collector2\n+   // generate warnings and notices\n+   // add replacements to replacementsMap\n+  }\n+};\n+```\n+\n+And you can use the `clangmetatool::MetaToolFactory` combined with the","path":"README.md","position":49,"original_position":49,"commit_id":"c044c3ec0b612ef382012e6411fbbecc1d13738f","original_commit_id":"c044c3ec0b612ef382012e6411fbbecc1d13738f","user":{"login":"burz","id":1555326,"node_id":"MDQ6VXNlcjE1NTUzMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/1555326?v=4","gravatar_id":"","url":"https://api.github.com/users/burz","html_url":"https://github.com/burz","followers_url":"https://api.github.com/users/burz/followers","following_url":"https://api.github.com/users/burz/following{/other_user}","gists_url":"https://api.github.com/users/burz/gists{/gist_id}","starred_url":"https://api.github.com/users/burz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burz/subscriptions","organizations_url":"https://api.github.com/users/burz/orgs","repos_url":"https://api.github.com/users/burz/repos","events_url":"https://api.github.com/users/burz/events{/privacy}","received_events_url":"https://api.github.com/users/burz/received_events","type":"User","site_admin":false},"body":"Can you change this to 'And then'?","created_at":"2018-07-13T15:47:15Z","updated_at":"2018-07-13T15:48:49Z","html_url":"https://github.com/bloomberg/clangmetatool/pull/6#discussion_r202393304","pull_request_url":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/comments/202393304"},"html":{"href":"https://github.com/bloomberg/clangmetatool/pull/6#discussion_r202393304"},"pull_request":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6","id":201329384,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxMzI5Mzg0","html_url":"https://github.com/bloomberg/clangmetatool/pull/6","diff_url":"https://github.com/bloomberg/clangmetatool/pull/6.diff","patch_url":"https://github.com/bloomberg/clangmetatool/pull/6.patch","issue_url":"https://api.github.com/repos/bloomberg/clangmetatool/issues/6","number":6,"state":"open","locked":false,"title":"add more detailed \"about\" section","user":{"login":"ruoso","id":81195,"node_id":"MDQ6VXNlcjgxMTk1","avatar_url":"https://avatars0.githubusercontent.com/u/81195?v=4","gravatar_id":"","url":"https://api.github.com/users/ruoso","html_url":"https://github.com/ruoso","followers_url":"https://api.github.com/users/ruoso/followers","following_url":"https://api.github.com/users/ruoso/following{/other_user}","gists_url":"https://api.github.com/users/ruoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ruoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruoso/subscriptions","organizations_url":"https://api.github.com/users/ruoso/orgs","repos_url":"https://api.github.com/users/ruoso/repos","events_url":"https://api.github.com/users/ruoso/events{/privacy}","received_events_url":"https://api.github.com/users/ruoso/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-13T15:43:57Z","updated_at":"2018-07-13T15:48:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00b6bd4a7c68921a3a1b6f0012b5b7a123f15a12","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6/commits","review_comments_url":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6/comments","review_comment_url":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bloomberg/clangmetatool/issues/6/comments","statuses_url":"https://api.github.com/repos/bloomberg/clangmetatool/statuses/c044c3ec0b612ef382012e6411fbbecc1d13738f","head":{"label":"ruoso:docs","ref":"docs","sha":"c044c3ec0b612ef382012e6411fbbecc1d13738f","user":{"login":"ruoso","id":81195,"node_id":"MDQ6VXNlcjgxMTk1","avatar_url":"https://avatars0.githubusercontent.com/u/81195?v=4","gravatar_id":"","url":"https://api.github.com/users/ruoso","html_url":"https://github.com/ruoso","followers_url":"https://api.github.com/users/ruoso/followers","following_url":"https://api.github.com/users/ruoso/following{/other_user}","gists_url":"https://api.github.com/users/ruoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ruoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruoso/subscriptions","organizations_url":"https://api.github.com/users/ruoso/orgs","repos_url":"https://api.github.com/users/ruoso/repos","events_url":"https://api.github.com/users/ruoso/events{/privacy}","received_events_url":"https://api.github.com/users/ruoso/received_events","type":"User","site_admin":false},"repo":{"id":139065383,"node_id":"MDEwOlJlcG9zaXRvcnkxMzkwNjUzODM=","name":"clangmetatool","full_name":"ruoso/clangmetatool","owner":{"login":"ruoso","id":81195,"node_id":"MDQ6VXNlcjgxMTk1","avatar_url":"https://avatars0.githubusercontent.com/u/81195?v=4","gravatar_id":"","url":"https://api.github.com/users/ruoso","html_url":"https://github.com/ruoso","followers_url":"https://api.github.com/users/ruoso/followers","following_url":"https://api.github.com/users/ruoso/following{/other_user}","gists_url":"https://api.github.com/users/ruoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ruoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruoso/subscriptions","organizations_url":"https://api.github.com/users/ruoso/orgs","repos_url":"https://api.github.com/users/ruoso/repos","events_url":"https://api.github.com/users/ruoso/events{/privacy}","received_events_url":"https://api.github.com/users/ruoso/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ruoso/clangmetatool","description":"A framework for reusing code in Clang tools","fork":true,"url":"https://api.github.com/repos/ruoso/clangmetatool","forks_url":"https://api.github.com/repos/ruoso/clangmetatool/forks","keys_url":"https://api.github.com/repos/ruoso/clangmetatool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruoso/clangmetatool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruoso/clangmetatool/teams","hooks_url":"https://api.github.com/repos/ruoso/clangmetatool/hooks","issue_events_url":"https://api.github.com/repos/ruoso/clangmetatool/issues/events{/number}","events_url":"https://api.github.com/repos/ruoso/clangmetatool/events","assignees_url":"https://api.github.com/repos/ruoso/clangmetatool/assignees{/user}","branches_url":"https://api.github.com/repos/ruoso/clangmetatool/branches{/branch}","tags_url":"https://api.github.com/repos/ruoso/clangmetatool/tags","blobs_url":"https://api.github.com/repos/ruoso/clangmetatool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruoso/clangmetatool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruoso/clangmetatool/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruoso/clangmetatool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruoso/clangmetatool/statuses/{sha}","languages_url":"https://api.github.com/repos/ruoso/clangmetatool/languages","stargazers_url":"https://api.github.com/repos/ruoso/clangmetatool/stargazers","contributors_url":"https://api.github.com/repos/ruoso/clangmetatool/contributors","subscribers_url":"https://api.github.com/repos/ruoso/clangmetatool/subscribers","subscription_url":"https://api.github.com/repos/ruoso/clangmetatool/subscription","commits_url":"https://api.github.com/repos/ruoso/clangmetatool/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruoso/clangmetatool/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruoso/clangmetatool/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruoso/clangmetatool/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruoso/clangmetatool/contents/{+path}","compare_url":"https://api.github.com/repos/ruoso/clangmetatool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruoso/clangmetatool/merges","archive_url":"https://api.github.com/repos/ruoso/clangmetatool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruoso/clangmetatool/downloads","issues_url":"https://api.github.com/repos/ruoso/clangmetatool/issues{/number}","pulls_url":"https://api.github.com/repos/ruoso/clangmetatool/pulls{/number}","milestones_url":"https://api.github.com/repos/ruoso/clangmetatool/milestones{/number}","notifications_url":"https://api.github.com/repos/ruoso/clangmetatool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruoso/clangmetatool/labels{/name}","releases_url":"https://api.github.com/repos/ruoso/clangmetatool/releases{/id}","deployments_url":"https://api.github.com/repos/ruoso/clangmetatool/deployments","created_at":"2018-06-28T20:30:08Z","updated_at":"2018-06-28T20:30:10Z","pushed_at":"2018-07-13T15:46:44Z","git_url":"git://github.com/ruoso/clangmetatool.git","ssh_url":"git@github.com:ruoso/clangmetatool.git","clone_url":"https://github.com/ruoso/clangmetatool.git","svn_url":"https://github.com/ruoso/clangmetatool","homepage":"https://bloomberg.github.io/clangmetatool/","size":1136,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bloomberg:master","ref":"master","sha":"4d1c27fb2b33ca8d3966204f29df689f488571cf","user":{"login":"bloomberg","id":1416818,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTY4MTg=","avatar_url":"https://avatars2.githubusercontent.com/u/1416818?v=4","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"repo":{"id":138797550,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg3OTc1NTA=","name":"clangmetatool","full_name":"bloomberg/clangmetatool","owner":{"login":"bloomberg","id":1416818,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTY4MTg=","avatar_url":"https://avatars2.githubusercontent.com/u/1416818?v=4","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bloomberg/clangmetatool","description":"A framework for reusing code in Clang tools","fork":false,"url":"https://api.github.com/repos/bloomberg/clangmetatool","forks_url":"https://api.github.com/repos/bloomberg/clangmetatool/forks","keys_url":"https://api.github.com/repos/bloomberg/clangmetatool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bloomberg/clangmetatool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bloomberg/clangmetatool/teams","hooks_url":"https://api.github.com/repos/bloomberg/clangmetatool/hooks","issue_events_url":"https://api.github.com/repos/bloomberg/clangmetatool/issues/events{/number}","events_url":"https://api.github.com/repos/bloomberg/clangmetatool/events","assignees_url":"https://api.github.com/repos/bloomberg/clangmetatool/assignees{/user}","branches_url":"https://api.github.com/repos/bloomberg/clangmetatool/branches{/branch}","tags_url":"https://api.github.com/repos/bloomberg/clangmetatool/tags","blobs_url":"https://api.github.com/repos/bloomberg/clangmetatool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bloomberg/clangmetatool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bloomberg/clangmetatool/git/refs{/sha}","trees_url":"https://api.github.com/repos/bloomberg/clangmetatool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bloomberg/clangmetatool/statuses/{sha}","languages_url":"https://api.github.com/repos/bloomberg/clangmetatool/languages","stargazers_url":"https://api.github.com/repos/bloomberg/clangmetatool/stargazers","contributors_url":"https://api.github.com/repos/bloomberg/clangmetatool/contributors","subscribers_url":"https://api.github.com/repos/bloomberg/clangmetatool/subscribers","subscription_url":"https://api.github.com/repos/bloomberg/clangmetatool/subscription","commits_url":"https://api.github.com/repos/bloomberg/clangmetatool/commits{/sha}","git_commits_url":"https://api.github.com/repos/bloomberg/clangmetatool/git/commits{/sha}","comments_url":"https://api.github.com/repos/bloomberg/clangmetatool/comments{/number}","issue_comment_url":"https://api.github.com/repos/bloomberg/clangmetatool/issues/comments{/number}","contents_url":"https://api.github.com/repos/bloomberg/clangmetatool/contents/{+path}","compare_url":"https://api.github.com/repos/bloomberg/clangmetatool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bloomberg/clangmetatool/merges","archive_url":"https://api.github.com/repos/bloomberg/clangmetatool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bloomberg/clangmetatool/downloads","issues_url":"https://api.github.com/repos/bloomberg/clangmetatool/issues{/number}","pulls_url":"https://api.github.com/repos/bloomberg/clangmetatool/pulls{/number}","milestones_url":"https://api.github.com/repos/bloomberg/clangmetatool/milestones{/number}","notifications_url":"https://api.github.com/repos/bloomberg/clangmetatool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bloomberg/clangmetatool/labels{/name}","releases_url":"https://api.github.com/repos/bloomberg/clangmetatool/releases{/id}","deployments_url":"https://api.github.com/repos/bloomberg/clangmetatool/deployments","created_at":"2018-06-26T21:51:44Z","updated_at":"2018-07-13T15:39:40Z","pushed_at":"2018-07-13T15:46:45Z","git_url":"git://github.com/bloomberg/clangmetatool.git","ssh_url":"git@github.com:bloomberg/clangmetatool.git","clone_url":"https://github.com/bloomberg/clangmetatool.git","svn_url":"https://github.com/bloomberg/clangmetatool","homepage":"https://bloomberg.github.io/clangmetatool/","size":1139,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":4,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6"},"html":{"href":"https://github.com/bloomberg/clangmetatool/pull/6"},"issue":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/issues/6"},"comments":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/bloomberg/clangmetatool/statuses/c044c3ec0b612ef382012e6411fbbecc1d13738f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"burz"}}