diff options
author | Chris Lattner <sabre@nondot.org> | 2009-09-19 19:47:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-09-19 19:47:14 +0000 |
commit | cea1438cf59c7cd3a632d61d78e68589315510d3 (patch) | |
tree | 59ff6f2ac9629a3a80cafa04852f75b6b5f734ad /include/llvm/ADT | |
parent | c2fc1fec6c8c5360828aa778e8fcc446bb9c6ae9 (diff) | |
download | external_llvm-cea1438cf59c7cd3a632d61d78e68589315510d3.zip external_llvm-cea1438cf59c7cd3a632d61d78e68589315510d3.tar.gz external_llvm-cea1438cf59c7cd3a632d61d78e68589315510d3.tar.bz2 |
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
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/StringRef.h | 17 |
1 files changed, 17 insertions, 0 deletions
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 /// @{ |