{"action":"created","issue":{"url":"https://api.github.com/repos/dlang/druntime/issues/2083","repository_url":"https://api.github.com/repos/dlang/druntime","labels_url":"https://api.github.com/repos/dlang/druntime/issues/2083/labels{/name}","comments_url":"https://api.github.com/repos/dlang/druntime/issues/2083/comments","events_url":"https://api.github.com/repos/dlang/druntime/issues/2083/events","html_url":"https://github.com/dlang/druntime/pull/2083","id":295686186,"number":2083,"title":"make demangle work with C++ mangled symbols using __cxa_demangle","user":{"login":"timotheecour","id":2194784,"avatar_url":"https://avatars2.githubusercontent.com/u/2194784?v=4","gravatar_id":"","url":"https://api.github.com/users/timotheecour","html_url":"https://github.com/timotheecour","followers_url":"https://api.github.com/users/timotheecour/followers","following_url":"https://api.github.com/users/timotheecour/following{/other_user}","gists_url":"https://api.github.com/users/timotheecour/gists{/gist_id}","starred_url":"https://api.github.com/users/timotheecour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timotheecour/subscriptions","organizations_url":"https://api.github.com/users/timotheecour/orgs","repos_url":"https://api.github.com/users/timotheecour/repos","events_url":"https://api.github.com/users/timotheecour/events{/privacy}","received_events_url":"https://api.github.com/users/timotheecour/received_events","type":"User","site_admin":false},"labels":[{"id":537492854,"url":"https://api.github.com/repos/dlang/druntime/labels/Bug%20Fix","name":"Bug Fix","color":"0052cc","default":false},{"id":660234731,"url":"https://api.github.com/repos/dlang/druntime/labels/WIP","name":"WIP","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-02-08T22:19:56Z","updated_at":"2018-02-09T13:01:45Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/dlang/druntime/pulls/2083","html_url":"https://github.com/dlang/druntime/pull/2083","diff_url":"https://github.com/dlang/druntime/pull/2083.diff","patch_url":"https://github.com/dlang/druntime/pull/2083.patch"},"body":"useful for projects that contained `extern(C++)` declarations; eg very useful for dmd and ldc that use a ton of these.\r\n\r\n* lazy loading: uses `dlopen` to discover whether platform supports `__cxa_demangle` when demangle encounters a symbol starting with `_Z`\r\n\r\n* uses an interesting pattern I found to make it easy for a pure function to reuse allocated data (and do lazy initializations) while at same time providing easy to user API for callers:\r\n\r\n```\r\n// declaration:\r\nchar[] demangleCXX(out DemangleCXXStatus status, const(char)[] buf,\r\n        DemangleCXX* data = Singleton!DemangleCXX(0)) nothrow pure @trusted;\r\n\r\n// caller: doesn't have to bother with auxiliary buffer\r\nauto ret=demangleCXX(status, buf);\r\n```\r\n\r\nmotivating example: this stacktrace would become demangled with this PR:\r\n```\r\ncore.exception.AssertError@dmd/e2ir.d(1063): Assertion failure\r\n----------------\r\n4   dmd                                 0x0000000106498b05 _d_assertp + 117\r\n5   dmd                                 0x00000001063a2e7b _ZN6toElem13ToElemVisitor5visitEP10Expression + 95\r\n6   dmd                                 0x000000010636f402 _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP14DefaultInitExp + 30\r\n7   dmd                                 0x000000010636f88d _Z8callfuncRK3LocP7IRStateiP4TypeP4elemS5_P15FuncDeclarationS5_S7_P5ArrayIP10ExpressionES7_ + 806\r\n...\r\n11  dmd                                 0x00000001063abd6f _ZN6toElem13ToElemVisitor5visitEP7CallExp + 1515\r\n12  dmd                                 0x00000001062c3dfd _ZN7CallExp6acceptEP7Visitor + 33\r\n22  dmd                                 0x0000000106360b2d _ZN14ScopeStatement6acceptEP7Visitor + 33\r\n34  dmd                                 0x000000010638ef3d _Z10genObjFileP6Moduleb + 1105\r\n35  dmd                                 0x00000001063239ba int dmd.mars.tryMain(ulong, const(char)**) + 9454\r\n36  dmd                                 0x000000010622d676 _Dmain + 38\r\n37  dmd                                 0x00000001064aac23 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll().__lambda1() + 39\r\n38  dmd                                 0x00000001064aaab3 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 31\r\n39  dmd                                 0x00000001064aab8e void rt.d\r\n```\r\n\r\nTODO: more documentation"},"comment":{"url":"https://api.github.com/repos/dlang/druntime/issues/comments/364427649","html_url":"https://github.com/dlang/druntime/pull/2083#issuecomment-364427649","issue_url":"https://api.github.com/repos/dlang/druntime/issues/2083","id":364427649,"user":{"login":"ibuclaw","id":397929,"avatar_url":"https://avatars3.githubusercontent.com/u/397929?v=4","gravatar_id":"","url":"https://api.github.com/users/ibuclaw","html_url":"https://github.com/ibuclaw","followers_url":"https://api.github.com/users/ibuclaw/followers","following_url":"https://api.github.com/users/ibuclaw/following{/other_user}","gists_url":"https://api.github.com/users/ibuclaw/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuclaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuclaw/subscriptions","organizations_url":"https://api.github.com/users/ibuclaw/orgs","repos_url":"https://api.github.com/users/ibuclaw/repos","events_url":"https://api.github.com/users/ibuclaw/events{/privacy}","received_events_url":"https://api.github.com/users/ibuclaw/received_events","type":"User","site_admin":false},"created_at":"2018-02-09T13:01:45Z","updated_at":"2018-02-09T13:01:45Z","author_association":"MEMBER","body":"> is there a library version of c++filt ?\r\n\r\nYes, it uses libiberty. The demangler in the library supports many languages, and has a better D demangler compared to core.demangle when I last checked also."}}
{"actor":{"display_login":"ibuclaw"}}