<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 29, 2016, at 10:50 AM, Zachary Turner <<a href="mailto:zturner@google.com" class="">zturner@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Sep 29, 2016 at 10:43 AM Enrico Granata <<a href="mailto:egranata@apple.com" class="">egranata@apple.com</a>> wrote:<br class=""></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 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_-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_-8285956238960707593Apple-converted-space gmail_msg"> </span>SyntheticChildrenTraversal::None),<br class="gmail_msg">                       <span class="Apple-converted-space"> </span>nullptr)<br class="gmail_msg">                   <span class="Apple-converted-space"> </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=""><br class=""></div><div class="">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=""></div><div>Sure, we just add a "vo" prefix, like vo__i_</div><div><br class=""></div><div>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 class=""><div class="" 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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline">Thanks,</div><div class="" 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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><i class="">- Enrico</i><br class="">📩 egranata@<font color="#ff2600" class=""></font>.com ☎️ 27683</div>
</div>
<br class=""></body></html>