{"action":"created","comment":{"url":"https://api.github.com/repos/google/protobuf/pulls/comments/26519849","id":26519849,"diff_hunk":"@@ -74,6 +74,11 @@ string SuperClassName(const Descriptor* descriptor);\n // anyway, so normally this just returns field->name().\n string FieldName(const FieldDescriptor* field);\n \n+// Get the sanitized name that should be used for the  given enum in C++ code.\n+// The name is optionally mangled for reserved keyword collisions. (Nested\n+// names need not be mangled as they receive a prefix from the outer message type.)\n+string EnumName(const EnumValueDescriptor* enum_value, bool mangle);","path":"src/google/protobuf/compiler/cpp/cpp_helpers.h","position":7,"original_position":7,"commit_id":"2062dd3f4a2d3c972011d5a82c60373c8f38e406","original_commit_id":"2062dd3f4a2d3c972011d5a82c60373c8f38e406","user":{"login":"pherl","id":315593,"avatar_url":"https://avatars.githubusercontent.com/u/315593?v=3","gravatar_id":"","url":"https://api.github.com/users/pherl","html_url":"https://github.com/pherl","followers_url":"https://api.github.com/users/pherl/followers","following_url":"https://api.github.com/users/pherl/following{/other_user}","gists_url":"https://api.github.com/users/pherl/gists{/gist_id}","starred_url":"https://api.github.com/users/pherl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pherl/subscriptions","organizations_url":"https://api.github.com/users/pherl/orgs","repos_url":"https://api.github.com/users/pherl/repos","events_url":"https://api.github.com/users/pherl/events{/privacy}","received_events_url":"https://api.github.com/users/pherl/received_events","type":"User","site_admin":false},"body":"Yes, the recommended way is to reference the nested enum from class scope,\nrather then using the underscore separated names. Also all the values\nshould be capitalized as suggested by the style guide. The conflicts should\nnot be common.\n\nOn Mon, Mar 16, 2015 at 10:58 AM cconroy <notifications@github.com> wrote:\n\n> In src/google/protobuf/compiler/cpp/cpp_helpers.h\n> <https://github.com/google/protobuf/pull/228#discussion_r26510550>:\n>\n> > @@ -74,6 +74,11 @@ string SuperClassName(const Descriptor* descriptor);\n> >  // anyway, so normally this just returns field->name().\n> >  string FieldName(const FieldDescriptor* field);\n> >\n> > +// Get the sanitized name that should be used for the  given enum in C++ code.\n> > +// The name is optionally mangled for reserved keyword collisions. (Nested\n> > +// names need not be mangled as they receive a prefix from the outer message type.)\n> > +string EnumName(const EnumValueDescriptor* enum_value, bool mangle);\n>\n> Are you sure you want it to always be mangled?\n>\n> That means we go from e.g. TestConflictingEnumNames_\n> NestedConflictingEnum_and to TestConflictingEnumNames_\n> NestedConflictingEnum_and_ ?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/google/protobuf/pull/228/files#r26510550>.\n>\n","created_at":"2015-03-16T19:38:22Z","updated_at":"2015-03-16T19:38:22Z","html_url":"https://github.com/google/protobuf/pull/228#discussion_r26519849","pull_request_url":"https://api.github.com/repos/google/protobuf/pulls/228","_links":{"self":{"href":"https://api.github.com/repos/google/protobuf/pulls/comments/26519849"},"html":{"href":"https://github.com/google/protobuf/pull/228#discussion_r26519849"},"pull_request":{"href":"https://api.github.com/repos/google/protobuf/pulls/228"}}},"pull_request":{"url":"https://api.github.com/repos/google/protobuf/pulls/228","id":30521592,"html_url":"https://github.com/google/protobuf/pull/228","diff_url":"https://github.com/google/protobuf/pull/228.diff","patch_url":"https://github.com/google/protobuf/pull/228.patch","issue_url":"https://api.github.com/repos/google/protobuf/issues/228","number":228,"state":"open","locked":false,"title":"Sanitize Enum names from collisions with reserved words.","user":{"login":"cconroy","id":3344240,"avatar_url":"https://avatars.githubusercontent.com/u/3344240?v=3","gravatar_id":"","url":"https://api.github.com/users/cconroy","html_url":"https://github.com/cconroy","followers_url":"https://api.github.com/users/cconroy/followers","following_url":"https://api.github.com/users/cconroy/following{/other_user}","gists_url":"https://api.github.com/users/cconroy/gists{/gist_id}","starred_url":"https://api.github.com/users/cconroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cconroy/subscriptions","organizations_url":"https://api.github.com/users/cconroy/orgs","repos_url":"https://api.github.com/users/cconroy/repos","events_url":"https://api.github.com/users/cconroy/events{/privacy}","received_events_url":"https://api.github.com/users/cconroy/received_events","type":"User","site_admin":false},"body":"Enum names should be sanitized just like other fields to avoid collisions.\r\n\r\nOld google code issue: https://code.google.com/p/protobuf/issues/detail?id=572\r\n\r\n\r\n","created_at":"2015-03-05T01:11:56Z","updated_at":"2015-03-16T19:38:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81786766685d32fb7d2ccc2fd026c09741e2df71","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/google/protobuf/pulls/228/commits","review_comments_url":"https://api.github.com/repos/google/protobuf/pulls/228/comments","review_comment_url":"https://api.github.com/repos/google/protobuf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/protobuf/issues/228/comments","statuses_url":"https://api.github.com/repos/google/protobuf/statuses/2062dd3f4a2d3c972011d5a82c60373c8f38e406","head":{"label":"cconroy:sanitize-enums","ref":"sanitize-enums","sha":"2062dd3f4a2d3c972011d5a82c60373c8f38e406","user":{"login":"cconroy","id":3344240,"avatar_url":"https://avatars.githubusercontent.com/u/3344240?v=3","gravatar_id":"","url":"https://api.github.com/users/cconroy","html_url":"https://github.com/cconroy","followers_url":"https://api.github.com/users/cconroy/followers","following_url":"https://api.github.com/users/cconroy/following{/other_user}","gists_url":"https://api.github.com/users/cconroy/gists{/gist_id}","starred_url":"https://api.github.com/users/cconroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cconroy/subscriptions","organizations_url":"https://api.github.com/users/cconroy/orgs","repos_url":"https://api.github.com/users/cconroy/repos","events_url":"https://api.github.com/users/cconroy/events{/privacy}","received_events_url":"https://api.github.com/users/cconroy/received_events","type":"User","site_admin":false},"repo":{"id":31688564,"name":"protobuf","full_name":"cconroy/protobuf","owner":{"login":"cconroy","id":3344240,"avatar_url":"https://avatars.githubusercontent.com/u/3344240?v=3","gravatar_id":"","url":"https://api.github.com/users/cconroy","html_url":"https://github.com/cconroy","followers_url":"https://api.github.com/users/cconroy/followers","following_url":"https://api.github.com/users/cconroy/following{/other_user}","gists_url":"https://api.github.com/users/cconroy/gists{/gist_id}","starred_url":"https://api.github.com/users/cconroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cconroy/subscriptions","organizations_url":"https://api.github.com/users/cconroy/orgs","repos_url":"https://api.github.com/users/cconroy/repos","events_url":"https://api.github.com/users/cconroy/events{/privacy}","received_events_url":"https://api.github.com/users/cconroy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cconroy/protobuf","description":"Protocol Buffers - Google's data interchange format","fork":true,"url":"https://api.github.com/repos/cconroy/protobuf","forks_url":"https://api.github.com/repos/cconroy/protobuf/forks","keys_url":"https://api.github.com/repos/cconroy/protobuf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cconroy/protobuf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cconroy/protobuf/teams","hooks_url":"https://api.github.com/repos/cconroy/protobuf/hooks","issue_events_url":"https://api.github.com/repos/cconroy/protobuf/issues/events{/number}","events_url":"https://api.github.com/repos/cconroy/protobuf/events","assignees_url":"https://api.github.com/repos/cconroy/protobuf/assignees{/user}","branches_url":"https://api.github.com/repos/cconroy/protobuf/branches{/branch}","tags_url":"https://api.github.com/repos/cconroy/protobuf/tags","blobs_url":"https://api.github.com/repos/cconroy/protobuf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cconroy/protobuf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cconroy/protobuf/git/refs{/sha}","trees_url":"https://api.github.com/repos/cconroy/protobuf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cconroy/protobuf/statuses/{sha}","languages_url":"https://api.github.com/repos/cconroy/protobuf/languages","stargazers_url":"https://api.github.com/repos/cconroy/protobuf/stargazers","contributors_url":"https://api.github.com/repos/cconroy/protobuf/contributors","subscribers_url":"https://api.github.com/repos/cconroy/protobuf/subscribers","subscription_url":"https://api.github.com/repos/cconroy/protobuf/subscription","commits_url":"https://api.github.com/repos/cconroy/protobuf/commits{/sha}","git_commits_url":"https://api.github.com/repos/cconroy/protobuf/git/commits{/sha}","comments_url":"https://api.github.com/repos/cconroy/protobuf/comments{/number}","issue_comment_url":"https://api.github.com/repos/cconroy/protobuf/issues/comments{/number}","contents_url":"https://api.github.com/repos/cconroy/protobuf/contents/{+path}","compare_url":"https://api.github.com/repos/cconroy/protobuf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cconroy/protobuf/merges","archive_url":"https://api.github.com/repos/cconroy/protobuf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cconroy/protobuf/downloads","issues_url":"https://api.github.com/repos/cconroy/protobuf/issues{/number}","pulls_url":"https://api.github.com/repos/cconroy/protobuf/pulls{/number}","milestones_url":"https://api.github.com/repos/cconroy/protobuf/milestones{/number}","notifications_url":"https://api.github.com/repos/cconroy/protobuf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cconroy/protobuf/labels{/name}","releases_url":"https://api.github.com/repos/cconroy/protobuf/releases{/id}","created_at":"2015-03-05T01:03:37Z","updated_at":"2015-03-05T01:03:40Z","pushed_at":"2015-03-15T03:11:34Z","git_url":"git://github.com/cconroy/protobuf.git","ssh_url":"git@github.com:cconroy/protobuf.git","clone_url":"https://github.com/cconroy/protobuf.git","svn_url":"https://github.com/cconroy/protobuf","homepage":"https://developers.google.com/protocol-buffers/","size":7217,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"9d31c227a3ab0260c3e6ebc7e1a555f47582dab4","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":23357588,"name":"protobuf","full_name":"google/protobuf","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/protobuf","description":"Protocol Buffers - Google's data interchange format","fork":false,"url":"https://api.github.com/repos/google/protobuf","forks_url":"https://api.github.com/repos/google/protobuf/forks","keys_url":"https://api.github.com/repos/google/protobuf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/protobuf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/protobuf/teams","hooks_url":"https://api.github.com/repos/google/protobuf/hooks","issue_events_url":"https://api.github.com/repos/google/protobuf/issues/events{/number}","events_url":"https://api.github.com/repos/google/protobuf/events","assignees_url":"https://api.github.com/repos/google/protobuf/assignees{/user}","branches_url":"https://api.github.com/repos/google/protobuf/branches{/branch}","tags_url":"https://api.github.com/repos/google/protobuf/tags","blobs_url":"https://api.github.com/repos/google/protobuf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/protobuf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/protobuf/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/protobuf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/protobuf/statuses/{sha}","languages_url":"https://api.github.com/repos/google/protobuf/languages","stargazers_url":"https://api.github.com/repos/google/protobuf/stargazers","contributors_url":"https://api.github.com/repos/google/protobuf/contributors","subscribers_url":"https://api.github.com/repos/google/protobuf/subscribers","subscription_url":"https://api.github.com/repos/google/protobuf/subscription","commits_url":"https://api.github.com/repos/google/protobuf/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/protobuf/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/protobuf/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/protobuf/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/protobuf/contents/{+path}","compare_url":"https://api.github.com/repos/google/protobuf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/protobuf/merges","archive_url":"https://api.github.com/repos/google/protobuf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/protobuf/downloads","issues_url":"https://api.github.com/repos/google/protobuf/issues{/number}","pulls_url":"https://api.github.com/repos/google/protobuf/pulls{/number}","milestones_url":"https://api.github.com/repos/google/protobuf/milestones{/number}","notifications_url":"https://api.github.com/repos/google/protobuf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/protobuf/labels{/name}","releases_url":"https://api.github.com/repos/google/protobuf/releases{/id}","created_at":"2014-08-26T15:52:15Z","updated_at":"2015-03-16T18:56:05Z","pushed_at":"2015-03-15T18:05:57Z","git_url":"git://github.com/google/protobuf.git","ssh_url":"git@github.com:google/protobuf.git","clone_url":"https://github.com/google/protobuf.git","svn_url":"https://github.com/google/protobuf","homepage":"https://developers.google.com/protocol-buffers/","size":20993,"stargazers_count":2317,"watchers_count":2317,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":535,"mirror_url":null,"open_issues_count":72,"forks":535,"open_issues":72,"watchers":2317,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/protobuf/pulls/228"},"html":{"href":"https://github.com/google/protobuf/pull/228"},"issue":{"href":"https://api.github.com/repos/google/protobuf/issues/228"},"comments":{"href":"https://api.github.com/repos/google/protobuf/issues/228/comments"},"review_comments":{"href":"https://api.github.com/repos/google/protobuf/pulls/228/comments"},"review_comment":{"href":"https://api.github.com/repos/google/protobuf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/protobuf/pulls/228/commits"},"statuses":{"href":"https://api.github.com/repos/google/protobuf/statuses/2062dd3f4a2d3c972011d5a82c60373c8f38e406"}}}}