diff options
author | Chris Lattner <sabre@nondot.org> | 2012-04-21 22:03:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-04-21 22:03:05 +0000 |
commit | 2dbd7844e831caa107c6c9c57889f3d89b843ef3 (patch) | |
tree | e16d435dac0b5ffbc08da5e7be55c244ff29a300 | |
parent | 55738761b393cc844e230a74e29edf4cdc37e9b8 (diff) | |
download | external_llvm-2dbd7844e831caa107c6c9c57889f3d89b843ef3.zip external_llvm-2dbd7844e831caa107c6c9c57889f3d89b843ef3.tar.gz external_llvm-2dbd7844e831caa107c6c9c57889f3d89b843ef3.tar.bz2 |
No need for "else if" after a return. Autosense "0o123" as octal in
StringRef::getAsInteger
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155298 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Support/StringRef.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Support/StringRef.cpp b/lib/Support/StringRef.cpp index abe570f..14d314b 100644 --- a/lib/Support/StringRef.cpp +++ b/lib/Support/StringRef.cpp @@ -272,14 +272,22 @@ static unsigned GetAutoSenseRadix(StringRef &Str) { if (Str.startswith("0x")) { Str = Str.substr(2); return 16; - } else if (Str.startswith("0b")) { + } + + if (Str.startswith("0b")) { Str = Str.substr(2); return 2; - } else if (Str.startswith("0")) { + } + + if (Str.startswith("0o")) { + Str = Str.substr(2); return 8; - } else { - return 10; } + + if (Str.startswith("0")) + return 8; + + return 10; } |