<div dir="ltr">Yea :( In practice you're right that it might not ever be an issue, but I know one time I spent quite a long time trying to figure out why I couldn't create a variable named "unix", so any time I see questionable names it brings back terrible memories.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 29, 2016 at 10:58 AM Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Sep 29, 2016, at 10:50 AM, Zachary Turner <<a href="mailto:zturner@google.com" class="gmail_msg" target="_blank">zturner@google.com</a>> wrote:</div><br class="m_9146638391998782858Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Thu, Sep 29, 2016 at 10:43 AM Enrico Granata <<a href="mailto:egranata@apple.com" class="gmail_msg" target="_blank">egranata@apple.com</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" 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 class="gmail_msg" style="word-wrap:break-word"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Sep 28, 2016, at 5:58 PM, Zachary Turner <<a href="mailto:zturner@google.com" class="gmail_msg" target="_blank">zturner@google.com</a>> wrote:</div><br class="m_9146638391998782858m_-8285956238960707593Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Wed, Sep 28, 2016 at 4:02 PM Enrico Granata via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="gmail_msg" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" 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"><br class="gmail_msg">-<br class="gmail_msg">+<br class="gmail_msg">+ static ConstString g___i_("__i_");<br class="gmail_msg">+<br class="gmail_msg"> // this must be a ValueObject* because it is a child of the ValueObject we are<br class="gmail_msg"> // producing children for<br class="gmail_msg"> // it if were a ValueObjectSP, we would end up with a loop (iterator -><br class="gmail_msg">@@ -281,6 +287,57 @@ bool lldb_private::formatters::LibCxxMap<br class="gmail_msg"> <span class="m_9146638391998782858m_-8285956238960707593Apple-converted-space gmail_msg"> </span>SyntheticChildrenTraversal::None),<br class="gmail_msg"> <span class="m_9146638391998782858Apple-converted-space gmail_msg"> </span>nullptr)<br class="gmail_msg"> <span class="m_9146638391998782858Apple-converted-space gmail_msg"> </span>.get();<br class="gmail_msg">+<br class="gmail_msg">+ if (!m_pair_ptr) {<br class="gmail_msg">+ m_pair_ptr = valobj_sp->GetValueForExpressionPath(".__i_.__ptr_", nullptr, nullptr, nullptr,<br class="gmail_msg">+ ValueObject::GetValueForExpressionPathOptions()<br class="gmail_msg">+ .DontCheckDotVsArrowSyntax()<br class="gmail_msg">+ .SetSyntheticChildrenTraversal(<br class="gmail_msg">+ ValueObject::GetValueForExpressionPathOptions::<br class="gmail_msg">+ SyntheticChildrenTraversal::None),<br class="gmail_msg">+ nullptr)<br class="gmail_msg">+ .get();<br class="gmail_msg">+ if (m_pair_ptr) {<br class="gmail_msg">+ auto __i_(valobj_sp->GetChildMemberWithName(g___i_, true));<br class="gmail_msg"></blockquote><div class="gmail_msg">Is there any reason we need to use such weird variable names? This looks like undefined behavior to me. Variables with more than one adjacent underscore are reserved.</div></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div class="gmail_msg" style="word-wrap:break-word"><div class="gmail_msg"><div class="gmail_msg">I am naming the variable the same as the corresponding variable in the type I am formatting. Future me is usually thankful when I do that.. it helps keep track of what ValueObject matches what child element; in this case, our iterators have an __i_ child</div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Ahh, makes sense. Unfortunately at least in this case it leads to illegal variable names. Is there anything else it could be named that would be similar enough to help remembering but a valid c++ identifier?</div></div></div></div></blockquote><br class="gmail_msg"></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg">Sure, we just add a "vo" prefix, like vo__i_</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I thought the rule about __ being magic only applied to global identifiers, and I have never seen any compiler complain about those identifiers in practice. But reserved is reserved, so thanks for pointing that out.</div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="m_9146638391998782858Apple-interchange-newline gmail_msg">Thanks,</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><i class="gmail_msg">- Enrico</i><br class="gmail_msg">📩 egranata@<font color="#ff2600" class="gmail_msg"></font>.com ☎️ 27683</div>
</div>
<br class="gmail_msg"></div></blockquote></div>