<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 16, 2013 at 6:44 PM, Eli Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.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><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Eli Bendersky</b> <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>></span><br>

Date: Tue, Apr 16, 2013 at 3:44 PM<br>Subject: Re: [llvm] r179601 - Cleanup naming: DataLayout s/TD/DL/<br>To: Jim Grosbach <<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>><br><br><br><div dir="ltr">
<div>
On Tue, Apr 16, 2013 at 2:44 PM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><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 style="word-wrap:break-word"><br><div><div>
<div>On Apr 16, 2013, at 2:32 PM, Eli Bendersky <<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>> wrote:</div><br><blockquote type="cite"><div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">


<div dir="ltr">On Tue, Apr 16, 2013 at 12:05 PM, Jim Grosbach<span> </span><span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank">grosbach@apple.com</a>></span><span> </span>wrote:<br><div class="gmail_extra">


<div class="gmail_quote"><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">DL and dl often are used for debugloc elsewhere. Thoughts on alternatives?</blockquote>


<div><br></div><div>Good point. I don't think there should be a lot of places where there's a conflict between the two, and wherever it is, the conflict can be resolved by using longer an more meaningful names. I'm not sure it's the only place in LLVM code where there's such a conflict...</div>


<div><br></div><div>Eli</div><div><br></div></div></div></div></div></blockquote></div><div>Sounds reasonable. Just something that caught my eye. Thanks!</div><span><font color="#888888"><div><br></div></font></span></div>


</div></blockquote><div><br></div><div><br></div></div><div>Rats... a lot of work has to be done to make it consistent:</div><div><br></div><div><div>$ git grep "\bTD\b" | grep "\.cpp"|wc -l</div>
<div>1766</div><div>$ git grep "\bDL\b" | grep "\.cpp"|wc -l</div><div>2705</div><div><br></div></div><div>And there are a number of places where both are used (FastIsel and its target subclasses, for instance).</div>


<div><br></div><div>DL makes more sense for DataLayout because it's most similar to other "information classes", i.e:</div><div><br></div><div><div>  const TargetMachine &TM;</div>
<div>  const DataLayout &TD;               <------------ DL</div><div>  const TargetInstrInfo &TII;</div><div>  const TargetLowering &TLI;</div><div>  const TargetRegisterInfo &TRI;</div><div><br></div>


<div>So DebugLoc probably has to cede its throne and be converted to DbgLoc or something similar? Again, that's ~4.5K substitutions to make in order to be completely consistent :-(</div><span class="HOEnZb"><font color="#888888"><span><font color="#888888"><div>
<br></div></font></span></font></span></div></div></div></div></div></div></blockquote><div><br></div><div style>Maybe it would be possible to whip up something with libTooling to automate it? You may be able to get the majority of them with a couple lines of ASTMatchers. Or maybe directly using a RecursiveASTVisitor would be simpler.</div>
<div style><br></div><div style>This whole issues actually brings up an interesting issue related to coding style. It seems like it is generally preferable that all variables of a given type across the codebase have the same name (subject to modifications if there's more than one in scope, and of course using longer names in the usual places where longer names are used). It would be interesting to collect metrics about which types have the most naming variability.</div>
<div style><br></div><div style>-- Sean Silva </div></div><br></div></div>