No, the comment as written makes more sense now.... Although the error doesn't entirely make sense.<div><br><div>But where are you seeing these errors? What compiler?</div><div><br></div><div>Unless this is a compiler bug (either in our compilers for not warning, or yours for warning) we should add a unittest to ensure that the call pattern in question continues to work.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 17, 2012 at 2:21 AM, Jin Gu Kang <span dir="ltr"><<a href="mailto:jaykang10@imrc.kist.re.kr" target="_blank">jaykang10@imrc.kist.re.kr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div dir="ltr"><font color="#000000" face="Tahoma">Thanks for your comment,</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">This comment means that this function's goal is to avoid ambigious overload error as following when we use NoFolder.</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr">/llvm-3.1.src/include/llvm/Support/IRBuilder.h:841: error: call of overloaded ‘CreateGetElementPtr(llvm::Constant*&, llvm::Constant*&)’ is ambiguous<br>
/llvm-3.1.src/include/llvm/Support/NoFolder.h:180: note: candidates are: llvm::Constant* llvm::NoFolder::CreateGetElementPtr(llvm::Constant*, llvm::ArrayRef<llvm::Constant*>) const<br>
/llvm-3.1.src/include/llvm/Support/NoFolder.h:194: note:                 llvm::Instruction* llvm::NoFolder::CreateGetElementPtr(llvm::Constant*, llvm::ArrayRef<llvm::Value*>) const</div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">What do you think about this comment?</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr">"Insertion of NoFolder functions to avoid ambiguous overload warnings or errors like ConstantFolder and TargetFolder."</div>
<div dir="ltr"><font face="times new roman"></font> </div>
<div dir="ltr"><font face="times new roman">Thanks,</font></div>
<div dir="ltr"><font face="times new roman">Jin-Gu Kang</font></div>
<div dir="ltr">
<hr>
</div>
<div dir="ltr"><font face="Tahoma"><b>From:</b> Chandler Carruth [<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>]<br>
<b>Sent:</b> Friday, August 17, 2012 6:01 PM<br>
<b>To:</b> Jin Gu Kang<br>
<b>Cc:</b> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [llvm-commits] [llvm] r162090 - /llvm/trunk/include/llvm/Support/NoFolder.h<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div class="gmail_extra">
<div class="gmail_quote">On Fri, Aug 17, 2012 at 1:54 AM, Jin-Gu Kang <span dir="ltr">
<<a href="mailto:jaykang10@imrc.kist.re.kr" target="_blank">jaykang10@imrc.kist.re.kr</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
Author: jaykang10<br>
Date: Fri Aug 17 03:54:57 2012<br>
New Revision: 162090<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=162090&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=162090&view=rev</a><br>
Log:<br>
Insertion of NoFolder functions to avoid ambiguous overload warnings or errors about whether to convert Idx to ArrayRef<Constant *> or ArrayRef<Value *> like ConstantFolder and TargetFolder.<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/Support/NoFolder.h<br>
<br>
Modified: llvm/trunk/include/llvm/Support/NoFolder.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=162090&r1=162089&r2=162090&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=162090&r1=162089&r2=162090&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/NoFolder.h (original)<br>
+++ llvm/trunk/include/llvm/Support/NoFolder.h Fri Aug 17 03:54:57 2012<br>
@@ -181,6 +181,12 @@<br>
                                 ArrayRef<Constant *> IdxList) const {<br>
     return ConstantExpr::getGetElementPtr(C, IdxList);<br>
   }<br>
+  Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {<br>
+    // This form of the function only exists to avoid ambiguous overload<br>
+    // warnings about whether to convert Idx to ArrayRef<Constant *> or<br>
+    // ArrayRef<Value *>.<br>
</blockquote>
<div><br>
</div>
<div>This comment doesn't seem right at all -- this function doesn't accept anything to do with ArrayRef. The comment seems copy/pasted from the edit below where it is correct, but it needs updating for this signature.</div>

<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
+    return ConstantExpr::getGetElementPtr(C, Idx);<br>
+  }<br>
   Instruction *CreateGetElementPtr(Constant *C,<br>
                                    ArrayRef<Value *> IdxList) const {<br>
     return GetElementPtrInst::Create(C, IdxList);<br>
@@ -190,6 +196,12 @@<br>
                                         ArrayRef<Constant *> IdxList) const {<br>
     return ConstantExpr::getInBoundsGetElementPtr(C, IdxList);<br>
   }<br>
+  Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const {<br>
+    // This form of the function only exists to avoid ambiguous overload<br>
+    // warnings about whether to convert Idx to ArrayRef<Constant *> or<br>
+    // ArrayRef<Value *>.<br>
+    return ConstantExpr::getInBoundsGetElementPtr(C, Idx);<br>
+  }<br>
   Instruction *CreateInBoundsGetElementPtr(Constant *C,<br>
                                            ArrayRef<Value *> IdxList) const {<br>
     return GetElementPtrInst::CreateInBounds(C, IdxList);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>

</blockquote></div><br></div>