[LLVMbugs] [Bug 2245] New: Misleading parameter name in llvm-c/Core.h:LLVMConstArray

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Apr 21 06:59:48 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2245

           Summary: Misleading parameter name in llvm-
                    c/Core.h:LLVMConstArray
           Product: new-bugs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: fvbommel at wxs.nl
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1596)
 --> (http://llvm.org/bugs/attachment.cgi?id=1596)
Patch to fix this.

LLVMConstArray is declared in include/llvm-c/Core.h as:
===
LLVMValueRef LLVMConstArray(LLVMTypeRef ArrayTy,
                            LLVMValueRef *ConstantVals, unsigned Length);
===
But is defined in lib/VMCore/Core.cpp as:
===
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
                            LLVMValueRef *ConstantVals, unsigned Length) {
  return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length),
                                 unwrap<Constant>(ConstantVals, Length),
                                 Length));
}
===
Note in particular the name of the first parameter.

While C++ allows this to compile and link without problems, this creates the
unfortunate impression to those reading the header that the first parameter
should be the type of the array, while it should actually be the type of the
*elements* of the array.

Trivial patch attached.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list