[LLVMbugs] [Bug 5207] New: APInt API is atrocious

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Oct 15 22:17:44 PDT 2009


           Summary: APInt API is atrocious
           Product: libraries
           Version: 1.0
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: code-cleanup
          Severity: normal
          Priority: P2
         Component: Support Libraries
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu

The APInt API is extremely inconsistent.  Among other things, some methods
update the APInt in place, and some return a new APInt.  This leads to awful
stuff like:

    V = V.lshr(ByteStart*8);

I think that we should fix this by changing operations that update in place to
have an _eq suffix, this would give us:

    V = V.lshr_eq(ByteStart*8);
    V = V.trunc_eq(ByteSize*8);

or, better yet in this case:


The ones that update in place should return void to make it really clear that
they do not return a new APInt.

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