From cea1438cf59c7cd3a632d61d78e68589315510d3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 19 Sep 2009 19:47:14 +0000 Subject: provide a "strtoull" operation that works on StringRef's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82322 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/StringRef.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/llvm') diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index 74d3eaa..2015a66 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -224,6 +224,23 @@ namespace llvm { } /// @} + /// @name Helpful Algorithms + /// @{ + + /// getAsInteger - Parse the current string as an integer of the specified + /// radix. If Radix is specified as zero, this does radix autosensing using + /// extended C rules: 0 is octal, 0x is hex, 0b is binary. + /// + /// If the string is invalid or if only a subset of the string is valid, + /// this returns true to signify the error. The string is considered + /// erroneous if empty. + /// + //bool getAsInteger(unsigned Radix, long long &Result) const; + bool getAsInteger(unsigned Radix, unsigned long long &Result) const; + + // TODO: Provide overloads for int/unsigned that check for overflow. + + /// @} /// @name Substring Operations /// @{ -- cgit v1.1