[LLVMbugs] [Bug 14961] New: Please use more explicit parameter names in headers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 15 16:31:45 PST 2013


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

             Bug #: 14961
           Summary: Please use more explicit parameter names in headers
           Product: new-bugs
           Version: 3.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rmann at latencyzero.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


As someone relatively new to LLVM, I find some things confusing. In this
instance, I'm using the Kaleidoscope Chapter 3 tutorial as a guide to how to
use LLVM in my own project. I looked at Type.h, line 395 (release_32):


  static PointerType *getInt8PtrTy(LLVMContext &C, unsigned AS = 0);

There are many lines like that. Note the names of the parameters, "C" and "AS".
While C's purpose is fairly easily inferred from its type, AS's purpose was
not. If instead the parameter name was "AddressSpace", it would've been
immediately apparent.

Similarly, on line 375:

  static IntegerType *getIntNTy(LLVMContext &C, unsigned N);

"N" is much more clear when written as "BitWidth" or something like that.

Note that although "C" is clear in the parameter declaration, it's probably
much less clear in the implementation, where it may appear several lines away
from the declaration. By convention, one can learn that "C" means "Context",
but using something a little more apparent, like "Context" or "CTX" makes
perusing the code a lot easier.

-- 
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