{"action":"created","comment":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/comments/47844545","id":47844545,"diff_hunk":"@@ -0,0 +1,199 @@\n+// Copyright (c) 2015 The Khronos Group Inc.\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a\n+// copy of this software and/or associated documentation files (the\n+// \"Materials\"), to deal in the Materials without restriction, including\n+// without limitation the rights to use, copy, modify, merge, publish,\n+// distribute, sublicense, and/or sell copies of the Materials, and to\n+// permit persons to whom the Materials are furnished to do so, subject to\n+// the following conditions:\n+//\n+// The above copyright notice and this permission notice shall be included\n+// in all copies or substantial portions of the Materials.\n+//\n+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS\n+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS\n+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT\n+//    https://www.khronos.org/registry/\n+//\n+// THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n+\n+// Validation tests for Logical Layout\n+\n+#include \"gmock/gmock.h\"\n+#include \"UnitSPIRV.h\"\n+#include \"ValidateFixtures.h\"\n+\n+#include <functional>\n+#include <sstream>\n+#include <string>\n+#include <utility>\n+\n+using std::function;\n+using std::ostream_iterator;\n+using std::pair;\n+using std::stringstream;\n+using std::string;\n+using std::tie;\n+using std::tuple;\n+using std::vector;\n+\n+using ::testing::HasSubstr;\n+\n+using ValidateLayout = spvtest::ValidateBase<\n+    tuple<int, pair<string, function<bool(int)>>>,\n+    SPV_VALIDATE_LAYOUT_BIT>;\n+\n+namespace {\n+\n+// returns true if order is equal to VAL\n+template <int VAL>\n+bool Equals(int order) {\n+  return order == VAL;\n+};\n+\n+// returns true if order is between MIN and MAX(inclusive)\n+template <int MIN, int MAX>\n+bool Range(int order) {\n+  return order >= MIN && order <= MAX;\n+};\n+\n+// clang-format off\n+// SPIRV source used to test the logical layout\n+vector<string> instructions = {","path":"test/Validate.Layout.cpp","position":69,"original_position":69,"commit_id":"f44c108b06d65a5f63c68c133618869b5b5231a7","original_commit_id":"f44c108b06d65a5f63c68c133618869b5b5231a7","user":{"login":"dneto0","id":13054574,"avatar_url":"https://avatars.githubusercontent.com/u/13054574?v=3","gravatar_id":"","url":"https://api.github.com/users/dneto0","html_url":"https://github.com/dneto0","followers_url":"https://api.github.com/users/dneto0/followers","following_url":"https://api.github.com/users/dneto0/following{/other_user}","gists_url":"https://api.github.com/users/dneto0/gists{/gist_id}","starred_url":"https://api.github.com/users/dneto0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dneto0/subscriptions","organizations_url":"https://api.github.com/users/dneto0/orgs","repos_url":"https://api.github.com/users/dneto0/repos","events_url":"https://api.github.com/users/dneto0/events{/privacy}","received_events_url":"https://api.github.com/users/dneto0/received_events","type":"User","site_admin":false},"body":"And now I see how this is used in the GenerateCode function.  I need to think more.","created_at":"2015-12-16T22:36:04Z","updated_at":"2015-12-16T22:36:04Z","html_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/47#discussion_r47844545","pull_request_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/comments/47844545"},"html":{"href":"https://github.com/KhronosGroup/SPIRV-Tools/pull/47#discussion_r47844545"},"pull_request":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47","id":53755602,"html_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/47","diff_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/47.diff","patch_url":"https://github.com/KhronosGroup/SPIRV-Tools/pull/47.patch","issue_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/47","number":47,"state":"open","locked":false,"title":"Logical layout validation","user":{"login":"umar456","id":457510,"avatar_url":"https://avatars.githubusercontent.com/u/457510?v=3","gravatar_id":"","url":"https://api.github.com/users/umar456","html_url":"https://github.com/umar456","followers_url":"https://api.github.com/users/umar456/followers","following_url":"https://api.github.com/users/umar456/following{/other_user}","gists_url":"https://api.github.com/users/umar456/gists{/gist_id}","starred_url":"https://api.github.com/users/umar456/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umar456/subscriptions","organizations_url":"https://api.github.com/users/umar456/orgs","repos_url":"https://api.github.com/users/umar456/repos","events_url":"https://api.github.com/users/umar456/events{/privacy}","received_events_url":"https://api.github.com/users/umar456/received_events","type":"User","site_admin":false},"body":"* Validates module level instructions for logical layout\r\n  conformance\r\n* Does not validate:\r\n  1. Function logical layout\r\n  2. Minor cases with OpVariable\r\n  3. Missing MemoryModel instruction in module\r\n  4. Order of function definition and function declaration\r\n* 782 unit tests for logical layout","created_at":"2015-12-15T20:12:26Z","updated_at":"2015-12-16T22:36:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5eeb28b674aadf6b1e6dcc60ef797a0da333f740","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47/commits","review_comments_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47/comments","review_comment_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/47/comments","statuses_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/statuses/f44c108b06d65a5f63c68c133618869b5b5231a7","head":{"label":"umar456:layout","ref":"layout","sha":"f44c108b06d65a5f63c68c133618869b5b5231a7","user":{"login":"umar456","id":457510,"avatar_url":"https://avatars.githubusercontent.com/u/457510?v=3","gravatar_id":"","url":"https://api.github.com/users/umar456","html_url":"https://github.com/umar456","followers_url":"https://api.github.com/users/umar456/followers","following_url":"https://api.github.com/users/umar456/following{/other_user}","gists_url":"https://api.github.com/users/umar456/gists{/gist_id}","starred_url":"https://api.github.com/users/umar456/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umar456/subscriptions","organizations_url":"https://api.github.com/users/umar456/orgs","repos_url":"https://api.github.com/users/umar456/repos","events_url":"https://api.github.com/users/umar456/events{/privacy}","received_events_url":"https://api.github.com/users/umar456/received_events","type":"User","site_admin":false},"repo":{"id":46513608,"name":"SPIRV-Tools","full_name":"umar456/SPIRV-Tools","owner":{"login":"umar456","id":457510,"avatar_url":"https://avatars.githubusercontent.com/u/457510?v=3","gravatar_id":"","url":"https://api.github.com/users/umar456","html_url":"https://github.com/umar456","followers_url":"https://api.github.com/users/umar456/followers","following_url":"https://api.github.com/users/umar456/following{/other_user}","gists_url":"https://api.github.com/users/umar456/gists{/gist_id}","starred_url":"https://api.github.com/users/umar456/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umar456/subscriptions","organizations_url":"https://api.github.com/users/umar456/orgs","repos_url":"https://api.github.com/users/umar456/repos","events_url":"https://api.github.com/users/umar456/events{/privacy}","received_events_url":"https://api.github.com/users/umar456/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/umar456/SPIRV-Tools","description":"","fork":true,"url":"https://api.github.com/repos/umar456/SPIRV-Tools","forks_url":"https://api.github.com/repos/umar456/SPIRV-Tools/forks","keys_url":"https://api.github.com/repos/umar456/SPIRV-Tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/umar456/SPIRV-Tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/umar456/SPIRV-Tools/teams","hooks_url":"https://api.github.com/repos/umar456/SPIRV-Tools/hooks","issue_events_url":"https://api.github.com/repos/umar456/SPIRV-Tools/issues/events{/number}","events_url":"https://api.github.com/repos/umar456/SPIRV-Tools/events","assignees_url":"https://api.github.com/repos/umar456/SPIRV-Tools/assignees{/user}","branches_url":"https://api.github.com/repos/umar456/SPIRV-Tools/branches{/branch}","tags_url":"https://api.github.com/repos/umar456/SPIRV-Tools/tags","blobs_url":"https://api.github.com/repos/umar456/SPIRV-Tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/umar456/SPIRV-Tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/umar456/SPIRV-Tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/umar456/SPIRV-Tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/umar456/SPIRV-Tools/statuses/{sha}","languages_url":"https://api.github.com/repos/umar456/SPIRV-Tools/languages","stargazers_url":"https://api.github.com/repos/umar456/SPIRV-Tools/stargazers","contributors_url":"https://api.github.com/repos/umar456/SPIRV-Tools/contributors","subscribers_url":"https://api.github.com/repos/umar456/SPIRV-Tools/subscribers","subscription_url":"https://api.github.com/repos/umar456/SPIRV-Tools/subscription","commits_url":"https://api.github.com/repos/umar456/SPIRV-Tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/umar456/SPIRV-Tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/umar456/SPIRV-Tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/umar456/SPIRV-Tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/umar456/SPIRV-Tools/contents/{+path}","compare_url":"https://api.github.com/repos/umar456/SPIRV-Tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/umar456/SPIRV-Tools/merges","archive_url":"https://api.github.com/repos/umar456/SPIRV-Tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/umar456/SPIRV-Tools/downloads","issues_url":"https://api.github.com/repos/umar456/SPIRV-Tools/issues{/number}","pulls_url":"https://api.github.com/repos/umar456/SPIRV-Tools/pulls{/number}","milestones_url":"https://api.github.com/repos/umar456/SPIRV-Tools/milestones{/number}","notifications_url":"https://api.github.com/repos/umar456/SPIRV-Tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/umar456/SPIRV-Tools/labels{/name}","releases_url":"https://api.github.com/repos/umar456/SPIRV-Tools/releases{/id}","created_at":"2015-11-19T18:58:25Z","updated_at":"2015-11-19T18:58:27Z","pushed_at":"2015-12-15T20:35:16Z","git_url":"git://github.com/umar456/SPIRV-Tools.git","ssh_url":"git@github.com:umar456/SPIRV-Tools.git","clone_url":"https://github.com/umar456/SPIRV-Tools.git","svn_url":"https://github.com/umar456/SPIRV-Tools","homepage":null,"size":912,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"KhronosGroup:master","ref":"master","sha":"532af9c09c8e58b9c3d68f65a2d1206d9ec71b66","user":{"login":"KhronosGroup","id":1608701,"avatar_url":"https://avatars.githubusercontent.com/u/1608701?v=3","gravatar_id":"","url":"https://api.github.com/users/KhronosGroup","html_url":"https://github.com/KhronosGroup","followers_url":"https://api.github.com/users/KhronosGroup/followers","following_url":"https://api.github.com/users/KhronosGroup/following{/other_user}","gists_url":"https://api.github.com/users/KhronosGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/KhronosGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KhronosGroup/subscriptions","organizations_url":"https://api.github.com/users/KhronosGroup/orgs","repos_url":"https://api.github.com/users/KhronosGroup/repos","events_url":"https://api.github.com/users/KhronosGroup/events{/privacy}","received_events_url":"https://api.github.com/users/KhronosGroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45981801,"name":"SPIRV-Tools","full_name":"KhronosGroup/SPIRV-Tools","owner":{"login":"KhronosGroup","id":1608701,"avatar_url":"https://avatars.githubusercontent.com/u/1608701?v=3","gravatar_id":"","url":"https://api.github.com/users/KhronosGroup","html_url":"https://github.com/KhronosGroup","followers_url":"https://api.github.com/users/KhronosGroup/followers","following_url":"https://api.github.com/users/KhronosGroup/following{/other_user}","gists_url":"https://api.github.com/users/KhronosGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/KhronosGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KhronosGroup/subscriptions","organizations_url":"https://api.github.com/users/KhronosGroup/orgs","repos_url":"https://api.github.com/users/KhronosGroup/repos","events_url":"https://api.github.com/users/KhronosGroup/events{/privacy}","received_events_url":"https://api.github.com/users/KhronosGroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KhronosGroup/SPIRV-Tools","description":"","fork":false,"url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools","forks_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/forks","keys_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/teams","hooks_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/hooks","issue_events_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/events{/number}","events_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/events","assignees_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/assignees{/user}","branches_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/branches{/branch}","tags_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/tags","blobs_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/statuses/{sha}","languages_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/languages","stargazers_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/stargazers","contributors_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/contributors","subscribers_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/subscribers","subscription_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/subscription","commits_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/contents/{+path}","compare_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/merges","archive_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/downloads","issues_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues{/number}","pulls_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls{/number}","milestones_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/milestones{/number}","notifications_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/labels{/name}","releases_url":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/releases{/id}","created_at":"2015-11-11T12:56:25Z","updated_at":"2015-12-11T02:43:11Z","pushed_at":"2015-12-15T20:12:26Z","git_url":"git://github.com/KhronosGroup/SPIRV-Tools.git","ssh_url":"git@github.com:KhronosGroup/SPIRV-Tools.git","clone_url":"https://github.com/KhronosGroup/SPIRV-Tools.git","svn_url":"https://github.com/KhronosGroup/SPIRV-Tools","homepage":null,"size":944,"stargazers_count":42,"watchers_count":42,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":7,"forks":9,"open_issues":7,"watchers":42,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47"},"html":{"href":"https://github.com/KhronosGroup/SPIRV-Tools/pull/47"},"issue":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/47"},"comments":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/KhronosGroup/SPIRV-Tools/statuses/f44c108b06d65a5f63c68c133618869b5b5231a7"}}}}