<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-size:12.8000001907349px">I don't see an existing test which tries to demangle '_Z1FPiRiOiMS0_FiiE'.  I think you should add it to test/test_demangle.pass.cpp</span></blockquote><div><br></div>'<span style="font-size:12.8000001907349px">_Z1FPiRiOiMS0_FiiE' is only an example, any mangled name with pointers or references will do.</span><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">By my count there's exactly</span></div><div><span style="font-size:12.8000001907349px">1 instance of parsing pointer to member ('M'),</span></div><div><span style="font-size:12.8000001907349px">3 instances of</span><span style="font-size:12.8000001907349px"> </span><span style="font-size:12.8000001907349px">parsing</span><span style="font-size:12.8000001907349px"> rvalue references ('O'),</span></div><div><span style="font-size:12.8000001907349px">17525 instances of </span><span style="font-size:12.8000001907349px">parsing </span><span style="font-size:12.8000001907349px">pointers ('P'), and</span></div><div><span style="font-size:12.8000001907349px">12149 instances of</span><span style="font-size:12.8000001907349px"> </span><span style="font-size:12.8000001907349px">parsing</span><span style="font-size:12.8000001907349px"> references ('R')</span></div><div><span style="font-size:12.8000001907349px">in the current test suite that invokes a .front() on an empty string.</span></div><div><br></div><div>These would be exposed if you compiled libc++abi.so <i>itself</i> with libcxx with asserts enabled, and as far as I can tell, this is not something that can be achieved by adding to the test suite.</div><div><br></div><div>BTW, there's a problem with the out of tree build that causes the test suite to use the wrong __cxa_demangle, since -lc++ (which includes its own copy) comes before -lc++abi in the test suite.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 26, 2015 at 7:50 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, May 26, 2015 at 7:22 PM, Chaoren Lin <span dir="ltr"><<a href="mailto:chaorenl@google.com" target="_blank">chaorenl@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi David,</div><div><br></div><div>Thanks for your concern.</div><div><br></div><div>The commit was intentional. I was hoping this small commit would fall under this part:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">smaller changes can be reviewed after commit</blockquote><div><br></div><div>of the <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_DeveloperPolicy.html-23code-2Dreviews&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=aGh5tAIr7DScHmcvkcx6kM36c-h3FHWSi_edqS34kls&s=0TaapSuRXvODMTTLBaAgZIn94NGrMChBoPHPPMNtEb4&e=" target="_blank">LLVM Developer Policy</a></div></div></blockquote><div><br></div></span><div>I'm afraid it doesn't because of the following proviso:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Code review can be an iterative process, which continues until the patch is ready to be committed. Specifically, once a patch is sent out for review, it needs an explicit “looks good” before it is submitted. Do not assume silent approval, or request active objections to the patch with a deadline.</blockquote><span class=""><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>We inlined a copy of this file in LLDB for Windows, and I ran into a problem where any mangled names with pointers or references in their argument list would cause a crash. Turns out that on Linux, String::front() consistently returns '\0' when empty, even though it should be undefined behavior. </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>It should be covered by existing tests if you enable asserts for libcxx and try to demangle "_Z1FPiRiOiMS0_FiiE".</div></div></blockquote><div><br></div></span><div>I don't see an existing test which tries to demangle '_Z1FPiRiOiMS0_FiiE'.  I think you should add it to test/test_demangle.pass.cpp</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Thanks,</div><div>Chaoren</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 26, 2015 at 4:43 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I didn't see anyone LGTM the phabricator review and no test has been added for this change.  Perhaps you accidentally committed this?<div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 26, 2015 at 4:14 PM, Chaoren Lin <span dir="ltr"><<a href="mailto:chaorenl@google.com" target="_blank">chaorenl@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: chaoren<br>
Date: Tue May 26 18:14:26 2015<br>
New Revision: 238263<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D238263-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=aGh5tAIr7DScHmcvkcx6kM36c-h3FHWSi_edqS34kls&s=DWiqqnQDVBlhRndWVAeShuEAwja_Irqve5sFRLQoZLk&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=238263&view=rev</a><br>
Log:<br>
Make sure !empty() before calling String::front().<br>
<br>
Reviewers: howard.hinnant<br>
<br>
Subscribers: cfe-commits<br>
<br>
Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9954&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=aGh5tAIr7DScHmcvkcx6kM36c-h3FHWSi_edqS34kls&s=fHXszyXaJINVWkTiTCf3-fRlgtGyLvKVEWDdlzGo8H8&e=" target="_blank">http://reviews.llvm.org/D9954</a><br>
<br>
Modified:<br>
    libcxxabi/trunk/src/cxa_demangle.cpp<br>
<br>
Modified: libcxxabi/trunk/src/cxa_demangle.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxxabi_trunk_src_cxa-5Fdemangle.cpp-3Frev-3D238263-26r1-3D238262-26r2-3D238263-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=aGh5tAIr7DScHmcvkcx6kM36c-h3FHWSi_edqS34kls&s=GkMEhteogm8svUApnh1qxEWdqyZsn3RY0fN6ClT9IJw&e=" target="_blank">http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=238263&r1=238262&r2=238263&view=diff</a><br>
==============================================================================<br>
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)<br>
+++ libcxxabi/trunk/src/cxa_demangle.cpp Tue May 26 18:14:26 2015<br>
@@ -1671,7 +1671,7 @@ parse_pointer_to_member_type(const char*<br>
                 auto func = std::move(db.names.back());<br>
                 db.names.pop_back();<br>
                 auto class_type = std::move(db.names.back());<br>
-                if (func.second.front() == '(')<br>
+                if (!func.second.empty() && func.second.front() == '(')<br>
                 {<br>
                     db.names.back().first = std::move(func.first) + "(" + class_type.move_full() + "::*";<br>
                     db.names.back().second = ")" + std::move(func.second);<br>
@@ -2018,7 +2018,8 @@ parse_type(const char* first, const char<br>
                                     db.names[k].first += " (";<br>
                                     db.names[k].second.insert(0, ")");<br>
                                 }<br>
-                                else if (db.names[k].second.front() == '(')<br>
+                                else if (!db.names[k].second.empty() &&<br>
+                                          db.names[k].second.front() == '(')<br>
                                 {<br>
                                     db.names[k].first += "(";<br>
                                     db.names[k].second.insert(0, ")");<br>
@@ -2045,7 +2046,8 @@ parse_type(const char* first, const char<br>
                                     db.names[k].first += " (";<br>
                                     db.names[k].second.insert(0, ")");<br>
                                 }<br>
-                                else if (db.names[k].second.front() == '(')<br>
+                                else if (!db.names[k].second.empty() &&<br>
+                                          db.names[k].second.front() == '(')<br>
                                 {<br>
                                     db.names[k].first += "(";<br>
                                     db.names[k].second.insert(0, ")");<br>
@@ -2079,7 +2081,8 @@ parse_type(const char* first, const char<br>
                                     db.names[k].first += " (";<br>
                                     db.names[k].second.insert(0, ")");<br>
                                 }<br>
-                                else if (db.names[k].second.front() == '(')<br>
+                                else if (!db.names[k].second.empty() &&<br>
+                                          db.names[k].second.front() == '(')<br>
                                 {<br>
                                     db.names[k].first += "(";<br>
                                     db.names[k].second.insert(0, ")");<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>