[LLVMbugs] [Bug 4745] New: Add recoverable string parsing errors to APInt and APFloat

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Aug 20 02:08:24 PDT 2009


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

           Summary: Add recoverable string parsing errors to APInt and
                    APFloat
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: idadesub at users.sourceforge.net
                CC: llvmbugs at cs.uiuc.edu


This is a bug to track the discussion we had on llvm-dev and irc about adding
recoverable string parsing to APInt and APFloat. I've attached the first
version to implementing this for APFloat. It converts most of the asserts in
the string parsing code to return "opInvalidString" if it finds an invalid
character.

Two open questions. First, in order to be efficient, I created a constructor
that can create an empty APFloat. Then, you can call "convertFromString" to
parse the string. This is a little ugly, however. Does anyone have a better
suggestion?

Second, it only has one error code, opInvalidString. Should we expose more
details, like "does not have exponent", or "too many dots in number", or is
opInvalidString sufficient?

Fortunately, it looks like most of the exposure of this patch is pretty small,
as only ConstantFP::get actually creates a APFloat from a string in the
codebase.

If this looks good, I'll do the same with APInt, which I expect will be a bit
simpler to do.


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