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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to